Owen Taylor wrote:

On Fri, 2003-03-28 at 09:41, Axel wrote:


hi
I m trying to open and read file which contains accentued characters like éèùà
so
I open a file, with GIOChannel and read the strings
but what is the function to get the encoding ?
I didn' t found it in API
I have seen call to convert to utf8 but it needs the original encoding from the string, and I didn' t found how to get it.
Someone could help me ?



How can GLib know this?


You can use g_get_charset() to find out the encoding of the
user's locale, but that doesn't necessarily correspond to
the encoding of a particular file on disk.

Regards,
Owen


Yes but imagine there are some people (me , by example) who have locales set to "POSIX"
and have though files with accentued characters, this don' t solve problems.
the problem is when I use g-io_channel_read*
I get the error : "Invalid byte sequence in conversion input" because glib wait for utf8 and found char like éééé orààà
so I found that :g_io_channel_set_encoding()
it take in argument the GIOChannel and an encoding, in a string
so passing "UTF8" set a GIOChannel to UTF8, I d like to pass another encoding
But I don' t know the encodings and strings I can use with that call.
API don' t talk about them
setting encoding of io channel , then read, and then convert to utf 8 should work
but first I need to know what encoding and string to pass to the function I can
use to set GIOChannel


Someone would have a pointer to them ?




Thanks Axel

_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to