GNOME Bugzilla – Bug 469053
g_unichar_to/from_string()
Last modified: 2009-04-08 20:57:07 UTC
Not sure how feasible these mostly trivial functions are, but can be useful for debugging, etc, (and in my case, for storing gunichar in gconf in a readable way). Essentially equivalent to: char *g_unichar_to_string (gunichar ch) G_GNUC_MALLOC; gunichar g_unichar_from_string (const char *s); char * g_unichar_to_string (gunichar ch) { char s[32]; g_snprintf (s, sizeof (s), "U+%04X", ch); s[sizeof (s) - 1] = '\0'; return strdup (s); } gunichar g_unichar_from_string (const char *s) { gunichar c = (gunichar) -1; sscanf (s, "[Uu]+%X", &c); return c; } Not sure from_string() should parse other formats like Ӓ and ካ too or not.
I documented how to read/write gunichars as part of bug 563156. Lets say this is not needed anymore.