Re: question about encoding



On Fri, Mar 28, 2003 at 11:57:09AM -0800, Charles Iliya Krempeaux wrote:
Hello,

On Fri, 2003-03-28 at 06: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 ?

I don't think that GIOChannel has anything to do with the encoding
of a string in a file.

To GIOChannel, you are dealing with a file.  It really doesn't
care what's in it.  It's just a bunch of bytes to it.

GIOChannel does have something to do with the encoding as it will invoke
iconv on your behalf. The functions on the interface are
g_io_channel_{get,set}_encoding. The conversion is always to UTF-8,
which what everything thing else in GTK+ libs expects.

And, if you already know that, then you'll probably need a way
to figure out what the data in the file is.  (This is file
dependent though.  GIOChannel is at a much lower level that
this... so it wouldn't provide an API for this kind of thing.)

But it does. GIOChannel has some pretty fairly high level conveniences
tailored for GTK+ application developers.




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