[Glade-users] problems with glade

Tomi Manninen oh2bns@sral.fi
Fri, 07 Nov 2003 02:34:18 +0200


On Fri, 2003-11-07 at 01:49, Albert wrote:

> Thanks Damon, 
> I try to convert the string to UTF-8 but the program return the same
> error:

>   out = g_convert(magatzem, -1,"UTF-8","ISO8859-1",NULL,NULL,NULL);
> 
>     gtk_text_buffer_set_text (buffer, magatzem, -1);

You are still passing the unmodified string (magatzem) to
gtk_text_buffer_set_text(). It's `out' that has the converted string.
And remember to free it later. So something like this:

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

  if (out == NULL) {
    /* handle error */
  }

  gtk_text_buffer_set_text (buffer, out, -1);
  g_free(out);

  ...

-- 
Tomi Manninen / OH2BNS / KP20ME04