Re: [gtkmm] Problem with g_io_channel_read_chars



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.

> 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?

> > > > 3. if I used g_locale_to_utf8(), should I remove ptr, that it has
> > > > returned, with g_free()?
> > >
> > > read the GLib API reference.
> >
> > Or just use Glib::locale_to_utf8() instead.
> 
> Heh, I have to learn more about glibmm :).

It's in the docs.  Right there on the frontpage, there's a link
"Character Set Conversion".

> Thanks, Daniel, you're always very good helper.
> And, I liked your work on CellRenderers :).

You're welcome ;)

--Daniel




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