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

Re: g_convert, =?utf-8?B?Z19sb2NhbGVfdG9f?==?utf-8?B?dXRmOCwgIsO2Ig==?= trouble



Jacob,

this is sorta wierd... Some suggestions, though:

On Thu, Oct 02, 2003 at 09:32:28PM +0200, Jacob Kolding wrote:
>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);
      
      For g_convert(), use GError, to check it did succeed.

>gtk_text_buffer_get_iter_at_offset(textbuffer, &iter, offset);

Before doing this call, just try doing
g_utf8_validate(buf2, -1, NULL) to see what does this function tell you.

>gtk_text_buffer_insert(textbuffer,&iter,buf2,strlen(buf2));
                                              ^^^^^^^^^^^^ try -1 here,
					      may be those aren't bytes but
					      chars...
>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
>
>_______________________________________________
>gtk-app-devel-list mailing list
>gtk-app-devel-list@gnome.org
>http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Bye.
--
 Pawel S. Veselov [vps] (MTS, Service Provisioning and OMA)   __ __(O) _ __
   (408) 276-5410   e-mail: Pawel.Veselov@Sun.COM             \ V /| || '  \
fax(408) 276-3243 HomePage: http://manticore.2y.net            \_/ |_||_|_|_|




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