> uchar= gdk_keyval_to_unicode(((GdkEventKey*)event)->keyval); > tmpbuf=g_new0(gchar,7); > g_unichar_to_utf8(uchar,tmpbuf); > res=g_locale_from_utf8(tmpbuf,-1,NULL,NULL,NULL);
In your previous message you said you want the character in Latin-1. The code above will give it in the locale's encoding (if possible), which might be something else in general. If you *know* you for some reason explicitly want Latin-1, converting from Unicode to Latin-1 is simple, just verify that the Unicode character value is less than 256 and use it as such. (Please note that many key presses *don't* correspond to any Unicode (or Latin-1, or whatever) character at all, like the shift, alt and control keys, and dead accent keys.) > for char ä i get this values > (((GdkEventKey*)event)->keyval = 65506 > (((GdkEventKey*)event)->keyval = 65111 > (((GdkEventKey*)event)->keyval = 97 Well, apparently you don't have any 'ä' key on the keyboard, and are entering the 'ä' character using a dead accent sequence. I.e. using two keystrokes, first the (dead) diaeresis key, then 'a'. Each GdkEventKey event corresponds to a physical key press or release, so you don't have any key press that would correspond to the 'ä' character as you don't have any 'ä' key on the keyboard. If you print the keyvals in hex and look them up in gdkkeysyms.h, you will see that: 65506 = 0xFFE2 = GDK_Shift_R 65111 = 0xFE57 = GDK_dead_diaeresis 97 = 0x61 = 'a' If you desperately need to get the 'ä' using a single keystroke, switch to a keyboard layout that has a 'ä' key... Also, your problem isn't exactly made easier by the fact that you apparently try to turn GDK events into emulated Windows messages. --tml _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list