g_convert, g_locale_to_utf8, =?ISO-8859-1?Q?=22=F6=22?= trouble



Hello All!

I'm writing an app that reads the output from cdrecord and
I have been going out of my mind trying to display an 'ö' in a
GtkTextBuffer.

I've tried:

gchar buf;
gchar *buf2;
g_io_channel_read(source, &buf, 1, &count);
buf2 = g_convert(&buf, 1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
gtk_text_buffer_get_iter_at_offset(textbuffer, &iter, offset);
gtk_text_buffer_insert(textbuffer,&iter,buf2,strlen(buf2));
g_free(buf2);

and the same with:

buf2 = g_locale_to_utf8(&buf, 1, NULL, NULL, NULL);

but I keep getting:

assertion `g_utf8_validate (text, len, NULL)' failed

What can I be doing wrong?

/Jacob Kolding




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