Map user-typed key strings to key codes properly.