Search code examples
c++linuxx11xlib

XLookupString does not detect 2 byte char language


I am using X11 library ,when I change keyboard language (for example Russian) I can't detect 2 bytes char like this : "ф" how should i change this part of code :

XEvent  ev;
if(ev.type==EVENT_KEY_RELEASE  || ev.type==EVENT_KEY_PRESS){
    XLookupString(KeyEvent,&cChar,1,&keysym,NULL);
}

this part working correctly for English language but for Russian cChar is empty, should I use other function instead of XLookupString?


Solution

  • For non-latin characters you should be using one of XmbLookupString, XwcLookupString or Xutf8LookupString see the manual page for details.