On Sat, 2008-05-17 at 11:43 +0200, Andreas Volz wrote: > Hello, > > I like to read Unicode strings into my gtkmm application that are > written in UTF-16. There's only the glib::ustring class to handle > UTF-8. Is there a UTF-16 string class or a way to convert the UTF-16 > string to UTF-8? > > Then I need to write back my Unicode strings in UTF-16. I found the > docs about "Character Set Conversion"[1], but I don't see how they'll > help me.
You can convert from UTF-16 to UTF-8 using g_utf16_to_utf8() (for which purpose you will need to include glib/gunicode.h). You will need to call g_free() on the return value after putting it in a Glib::ustring object. You can go the other way with g_utf8_to_utf16(). It returns an array of type gunichar2, which is typedef'ed to guint16, also requiring to be g_free'd when you have finished with it. Chris _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list