Fix keypress on special keys and keydown/keyup on characters

This fix allows to handle special keys with `keypress` event (special keys can trigger all kinds of events with valid `keyCode`). It also fixes usage of invalid character codes on `keydown`/`keyup` events (valid `charCode` available only with `keypress` events, though we have to use `which` property because IE passes character codes in `keyCode`)

Reference used: http://www.quirksmode.org/js/keys.html