Keyboard Send Any Unicode Character?

Status
Not open for further replies.
Is there a way to send any unicode character as a keypress in a cross platform way? I could code a way to send Alt-Codes to windows but it would be great to just be able to set the character in a character literal and have a function send that as a keypress in a way that works for any OS. I've tried sending characters such as `²` or `√` in `Keyboard.press()` but they don't actually produce anything on the computer.
 
The main issue is the HID standard defines usage numbers for the various fixed key positions, not their characters.

Apparently this was decided in the formative days of USB where keyboard manufacturers refused to adopt any protocol which requires customizing the electronics in keyboard. They needed to make every keyboard identical and merely put different printing on the key caps. Keyboard support was considered essential to the success of USB, so even though the rest of the protocol goes to great lengths to express semantic meaning and internationalize everything (at least in the early-90s vision of 16 bit unicode being universal), keyboards have HID usage numbers defined in terms of physical key position.

So as a USB keyboard, you can only send about 100 different usage numbers corresponding to the physical keys. It's up to the USB host to know which keyboard layout you have and to translate those numbers into the actual characters.
 
I figured that would be the case. I'll probably create a library to enter the appropriate Alt codes or Ctrl + Shift + U commands which is annoying as I'd need to store both numbers for each input and pretty much store full database of values to lookup. I might create an application to handle it via serial communication instead.
 
Status
Not open for further replies.
Back
Top