Set the character when event.which is available

- Instead of hardcoding which events have character codes, just
check if we have one with event.which