Re: Invalid byte sequence in conversion input
- From: "chen.shengqi" <chen shengqi connet com tw>
- To: <rroth uiuc edu>, "GTK App Devel List" <gtk-app-devel-list gnome org>
- Subject: Re: Invalid byte sequence in conversion input
- Date: Fri, 17 Jan 2003 17:04:23 +0800
maybe you should
g_io_channel_set_encoding(file_io_channel, NULL, &error);
the default encoding is utf8.
I am trying to read some text out of a file. It works if I do it this way:
while (read_bytes!=0) {
g_io_channel_read(file_io_channel, readbuffer, READBUFLENGTH, &read_bytes);
/* Add the text to the text in memory */
text=g_string_append(text, g_strndup(readbuffer,read_bytes));
}
however, I tried doing it without the loop by calling
g_io_channel_read_to_end(file_io_channel, &readtext, &length, &error);
This, however, gives an error, specifically that
"Invalid byte sequence in conversion input"
Given the same file, the first method always works, but the second chokes
on certain files. Is the second one doing some kind of extra conversion
that the first one isn't? If so, why? Can I tell it not to? I can't
control the contents of the files being read.
Thanks!
-Ron
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]