BP key press event: input of layout-dependent shifted/special characters

For a typewriter-like actor (in my case a key-punch, see let's program an IBM 1401, part 4: let's load a program from card (hello world) - YouTube) I’d like to catch the exact character that was typed, like in an editor application.

That means if e.g. someone types a “/” (slash), I want to add the slash to a string.


e.g. on an US keyboard, I get “SLASH” as the key parameter, since it’s a dedicated key on the keyboard.

e.g. on a german keyboard, the slash is above the 7, so one has to press SHIFT-7.
But this creates one “SHIFT” event, and then one “7” event, but never a “SLASH” event.

For these two cases it’s trivial, but since there are whole range of special characters and a bunch of different keyboard layouts, it would be tedious to cover each case.

Is it possible (also C++ if necessary) to get the exact character the user intended to type in?

(the plugins I found try to get the physical key, independent of the layout, but in this case it’s the opposite: other key, but exactly the layout-dependent character on that key)