Text input is hard. AFAIK in SDL we only have SDL_TEXTINPUT
events on keypress that have input char (may consist of several Unicode codepoints).
And there is no crossplatform way in SDL how to manually convert keycode\scancode to char (multiple unicode chars).
For Windows you can use ToUnicodeEx() API to convert scancode + vkcode + keyboard state (array of pressed keys + modifiers) to character in HKL layout. This function is used inside Windows to convert WM_KEYDOWN
messages to WM_CHAR
inside TranslateMessage() call (there are additional stuff like ALT+KEY codes processing on this way). WM_CHAR
in result get converted to SDL_TEXTINPUT
by SDL code.