Re: [gtkmm] Problem with g_io_channel_read_chars



> From: "Andrew E. Makeev" <andrew solvo ru>
>
> Daniel Elstner wrote:
>
> > Am Mon, 2002-06-10 um 11.33 schrieb Andrew E. Makeev:
> > >
> > > 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
> ref.
>
> 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.

Not completely true. It can produce an error when setting the encoding to
NULL if 1) the encoding has already been set to something besides
UTF-8, and 2) you've already read/written some data through the
channel.

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

Is this a file you're working with, or a socket? With sockets, you often
need to set the channel to non-blocking, esp. since GIOChannel now
does its own buffering.

Ron Steinke



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