The most important data related to a keyboard event is the identity
of either the physical key being activated or the character generated
by that key. These are not the same things. Every key has a numeric
code associated with it. For example, a U.S. English keyboard assigns
the number 65 to the key labeled A.
That same key, however, can produce at least two different characters
(A and a) on every U.S.
computer, and even more characters on operating systems like the
Macintosh (where the Option and
Option-Shift modifier keys let that
A key generate even more
characters).
It so happens that the code "65" is
also the ASCII and Unicode value of the uppercase
A letter (this isn't a
coincidence as much as it reflects the English-centric basis of early
computing). The character codes for the A and
a characters are 65 and 97, respectively. For some
scripting tasks, the character code is important—such as
whether the character is a numeral, regardless of whether the user
pressed a top row keyboard key or a numeric keypad key; for other
tasks, the key pressed is important—such as whether the user
pressed the PageDown key (which
doesn't have a character associated with it).