#include #include #include #include #include #include #include #define ASSERT(foo) if (!(foo)) { fprintf(stderr,#foo "failed\n"); exit(1); } static char* fallback_resources[] = { NULL }; int main(int argc, char * argv[]) { Display *display; char *c = "abé"; XTextProperty textprop; XtAppContext app_con; int res; Widget w; XtSetLanguageProc(NULL,NULL,NULL); ASSERT(w=XtVaOpenApplication(&app_con,"testx", NULL, 0, &argc, argv, fallback_resources, sessionShellWidgetClass, XtNallowShellResize, True, NULL)); ASSERT(display=XtDisplay(w)); ASSERT((res = Xutf8TextListToTextProperty(display,&c,1,XCompoundTextStyle,&textprop))>=0); printf("'%s' -> '%s' %lx %d %lu (%d,'%s')\n",c,(char *)textprop.value, textprop.encoding, textprop.format, textprop.nitems, res, XDefaultString()); return 0; }