convert keycodes to ascii and add meta key masks