Re: Unhandled exception?



On Tue, 27 May 2014 13:18:25 -0400
Phillip Susi <susi ubuntu com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/27/2014 12:59 PM, Chris Vine wrote:
If you want to treat input text as text, but don't know the
encoding, you are stuffed, so just catch the conversion exception
and abort, or try to deduce the codeset for yourself and abort when
you fail.  If you want to treat it as binary data, treat it as
binary data and all will be well.

Rather than abort, it would be preferable to ignore the bad characters
and keep reading.  Either that or replace them with the unknown
character.  It doesn't look like IOChannel provides a way to recover
from this exception though, other than closing the IOChannel and
giving up.

A couple of posts ago you were arguing it should abort (which you can
set it to do, as I mentioned).

I don't think GIOChannel is being developed any more.  The best thing
to do is to move to GIO.  GCharsetConverter (Gio::CharsetConverter) has
a 'use-fallback' property which seems to do what you want with
Gio::ConverterInputStream (although I have never tried it).

Chris


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