Re: Displaying a UTF-8 file in a text view

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

 



On Sun, Feb 25, 2007 at 03:58:57AM +0000, Kumar Appaiah wrote:
> I am trying to display a UTF-8 file in a very simple GTK+ application using a
> text view
> ...
> actualText = g_convert((const gchar *)buf, (gssize) n,
>                        "UTF-8",
>                        "ISO8859-1",
>                        &n_read,
>                        &n_written,
>                        NULL);

If the file is already in UTF-8, why you convert it from ISO
Latin1 to UTF-8?  And if it isn't in UTF-8, why you call it
`UTF-8 file'?  This does not make sense.

>  gtk_text_buffer_set_text(GTK_TEXT_BUFFER(textBuffer),
>                           actualText, n);

n is not the length of the converted text in bytes (unless
it's pure ASCII), it's the length of the text *before*
conversion.  So in addition to being possibly misconverted
the text is truncated too.

Yeti


--
Whatever.
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux