Re: Writing Unicode to a GTK TextBuffer



Raymond Wan <rwan cs mu oz au> writes: 
>         11000010 10101001 = 0xc2 0xa9

char buf[3] = { 0xc2, 0xa9, '\0' }
 
> 	I've tried a few things such as using the function
> "g_utf8_get_char"

char buf[7];
int len;

len = g_unichar_to_utf8 (176, buf);
buf[len] = '\0';
 
> 	Also, I've found many tables of characters in UTF-16...is there a
> table for me to convert to UTF-8 manually?  (That is, if I found that a
> character is 3042 in UTF-16 (Japanese A-character), can I find out what it
> is in UTF-8 so that I can use it in GTK+?).
> 

The characters are the same for UTF-8 and UTF-16. The encoding is
different. i.e. "gunichar" is the same for both. 

There's g_utf8_to_utf16() and g_ucs4_to_utf16(). ucs4 is simply an
array of gunichar.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]