This is an exact duplicate of this question; however the code linked in the accepted answer is nearly 11 years old, and this comment in the code leads to my duplicate question:
The keysym -> UTF-8 conversion will hopefully one day be provided by Xlib via XmbLookupString() and should ideally not have to be done in X applications. But we are not there yet.
Are we there yet? I'm aware of XwcLookupString
, but something like...
wchar_t unicode = XKeySymToWideChar( keysym );
... would be much simpler and logical, and not require updating whenever KeySyms are added or changed.
Is there a simple function in X11/Xlib that will map a KeySym to its Unicode equivalent?