Fix handling of metacharacters in unicode mode

Metastates were being mishandled by the unicode keyboard. Fixes #3631.