Re: Displaying a UTF-8 file in a text view
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-list gnome org
- Subject: Re: Displaying a UTF-8 file in a text view
- Date: Sun, 25 Feb 2007 10:53:27 +0100
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]