Writing Unicode to a GTK TextBuffer

Hi all,

	Sorry for another newbie question, but I've been struggling with
this for a while and can't seem to figure out how to do this.  All I want
to do is store a UTF-8 character in some variable and be able to print it
out in a TextBuffer, possibly with some colouring.

	For example, I have some manpages that says that the copyright
symbol in UTF-8 is:

        11000010 10101001 = 0xc2 0xa9

	How do I write this to a TextBuffer in GTK+?  I'm actually porting
from 1.2.X to 1.3.5 and in my old version, I had this: 

static char dot[] = { (char) 176 };
gtk_text_insert (GTK_TEXT (window), NULL, &blue, NULL, dot, 1);

	[where ASCII code 176 is the degrees symbol].  I'm now using: 
gtk_text_buffer_insert_with_tags_by_name (...) for 1.3.5 .  If I put
anything in "dot" that is > ASCII code 127, I get a runtime error from

	I've tried a few things such as using the function
"g_utf8_get_char", but I'm definitely on the wrong track and using it
incorrectly. The sample code I've seen that came with GTK+ 1.3.5 has UTF-8
characters hard coded some how in the source code...

	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+?).

	Thank you in advance!


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