[Glade-users] problems with glade

Albert albert@vorwireless.net
07 Nov 2003 01:04:55 +0100


Is strange that the text_view show the last line of file.
I try :

out = g_convert(magatzem,
strlen(magatzem),"UTF-8","ISO8859-1",NULL,NULL,NULL);

but returns the same error.

thanks for you time

Albert

El vie, 07 de 11 de 2003 a las 00:49, Albert escribió:
> Hi all,
> 
> Thanks Damon, 
> I try to convert the string to UTF-8 but the program return the same
> error:
> 
> ----------------- 8< interface.c --------
> [...]
> 
> 
>   FILE *correu;
>   int a, i;
>   char magatzem[1024];
>   gchar *out;
>   correu = fopen("/tmp/tenes777","r");
>   textbox = gtk_text_view_new();
>   buffer = gtk_text_buffer_new (NULL);
>   while (!feof(correu)) {
>   fgets(magatzem, 1000, correu);
>   a++;
>   if (strstr(magatzem, "[Tenes777]") != NULL) {
> 
>   out = g_convert(magatzem, -1,"UTF-8","ISO8859-1",NULL,NULL,NULL);
> 
>     gtk_text_buffer_set_text (buffer, magatzem, -1);
>     gtk_text_view_set_buffer (GTK_TEXT_VIEW (textbox), buffer);
>     gtk_widget_show (textbox);
>     i++;
>   }
>  }
> 
> 
> [ ... ]
> ------------------------- 8< ------------------------
> 
> it returns:
> 
> (tenes777:5866): Gtk-CRITICAL **: file gtktextbuffer.c: line 543
> (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text, len,
> NULL)' failed
> 
> (tenes777:5866): Gtk-CRITICAL **: file gtktextbuffer.c: line 543
> (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text, len,
> NULL)' failed
> 
> (tenes777:5866): Gtk-CRITICAL **: file gtktextbuffer.c: line 543
> (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text, len,
> NULL)' failed
> 
> (tenes777:5866): Gtk-CRITICAL **: file gtktextbuffer.c: line 543
> (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text, len,
> NULL)' failed
> 
> (tenes777:5866): Gtk-CRITICAL **: file gtktextbuffer.c: line 543
> (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text, len,
> NULL)' failed
> 
> (tenes777:5866): Gtk-CRITICAL **: file gtktextbuffer.c: line 543
> (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text, len,
> NULL)' failed
> 
> 
> Thanks for you time,
> 
> Albert
> 
> El jue, 06 de 11 de 2003 a las 10:34, Damon Chaplin escribió:
> > On Thu, 2003-11-06 at 00:41, Albert wrote:
> > 
> > > (tenes777:4771): Gtk-CRITICAL **: file gtktextbuffer.c: line 543
> > > (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text, len,
> > > NULL)' failed
> > 
> > I'd guess your file uses an encoding other than UTF-8.
> > Do you know what encoding is used in the file?
> > You can use g_convert() from glib to convert it to UTF-8.
> > 
> > Try using a plain ASCII file to see if that works.
> > 
> > Damon
> > 
> > 
> > _______________________________________________
> > Glade-users maillist  -  Glade-users@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/glade-users
> 
> _______________________________________________
> Glade-users maillist  -  Glade-users@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-users