Re: [gtkmm] Problem with g_io_channel_read_chars

Daniel Elstner wrote:

> Am Mon, 2002-06-10 um 11.33 schrieb Andrew E. Makeev:
> > >
> > > I doubt this is mentioned in the GLib API reference.  Without explicit
> > > charset handling the protocol, you're basically fucked.  Hmm.  I might
> > > be missing something, dunno.
> >
> > Well, I know about g_io_channel_get_encoding, I meant I would to know encoding
> > of data I just read from the channel.
> Then I guessed your question right :)  As I said, basically you can't
> know the encoding, unless you're using a protocol that supports this
> feature.  I don't know whether telnet (I assume that's what you're
> doing) supports it.  If not, you've no choice but making the encoding
> configurable by the user.

Well, I just looked for simplest way to do it... My task isn't supposed to be
universal tool, so, I could handle encoding myself.

> > Btw, if I did
> > g_io_channel_set_encoding(chan, 0, 0) (that should set encoding to NULL, right?
> > or I had to send "NULL" as parameter?) g_io_channel_read_chars() returned same
> > conversion error as before.
> I think 0 is correct.  Have you checked whether changing the encoding
> actually suceeded?  The GLib API doc describes when you're allowed to
> set it.  Also, are you sure it fails in g_io_channel_read_chars(), and
> not somewhere else when you're trying to use the data?

Yes, I checked the encoding with g_io_channel_get_encoding, it was set to NULL. And
I had G_IO_STATUS_NORMAL and no GError returned (just skipped it in the e-mail).
Also, I followed all conditions to call g_io_channel_set_encoding() according to API

But... Since I studied giochannel.c, goiunix.c code thoroughly, I found that it
could produce such error only if some type of encoding was set.

Last time I've tried NULL encoding (KOI8-R as well), g_io_channel_read_chars() never

I guess, it's the problem that some glib coders should worry about, though.


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