Improve normalization of charCode, fix FF not reporting Enter

#1955

Haven't tested it yet (it's late), I'll run it through some manual tests tomorrow.
Nit: `var` for each.