#include #include #include typedef int (*Func) (Display *, char **, int, XICCEncodingStyle, XTextProperty *); static const struct { char *label; Func func; } data[] = { { "Xutf8TextListToTextProperty", Xutf8TextListToTextProperty }, { "XmbTextListToTextProperty", XmbTextListToTextProperty }, { NULL, 0 } }; int main (int argc, char *argv[]) { Display *display; const char *text = "√"; XTextProperty tp; int ret; int i, j; display = XOpenDisplay (NULL); for (i = 0; data[i].label; i++) { tp.value = 0; ret = data[i].func (display, (char **)&(text), 1, XCompoundTextStyle, &tp); if (tp.value) { printf ("%s ret:%d value: ", data[i].label, ret); for (j = 0; tp.value[j]; j++) printf ("%x ", tp.value[j]); printf ("\n"); } else { printf ("%s ret:%d value:0\n", data[i].label, ret); } } return 0; }