Fix keypress handling in IE8 and Opera.

evt.charCode which was used to determine if the key was nonprintable
is always undefined on IE <= 8 and Opera. Instead we should look at
the original value of evt.which (before normalization) and see if it is
undefined or non-zero. In this case, we know it is a printable key.

There is one additional check necessary because some browsers send
both keydown and keypress events for backspace/tab/enter/escape.