This is an exact duplicate of this question ; however, the code associated with the accepted answer is almost 11 years old, and this comment in the code leads to my duplicate question:
The conversion of keysym → UTF-8, we hope one day will be provided by Xlib via XmbLookupString () and ideally should not be done in X Applications. But we are not there yet.
Are we still there? I know XwcLookupString , but something like ...
wchar_t unicode = XKeySymToWideChar( keysym );
... will be much simpler and more logical and does not require updating when adding or changing KeySyms.
Is there a simple function in X11 / Xlib that maps KeySym to its Unicode equivalent?
source share