No dialogs, please :)  Actually, it would be fine if there were a different 
stream class or simply a different method/state (encoding =#userInteraction or 
something??) that is understood to negotiate such details with "the user."  In 
general, exception is the correct way to handle this: the stream "knows" what 
is wrong; the application will know what to make of it.  If the encoding can be 
detected automatically, that would be great.

Firefox tells me that the encoding is ISO-8859-1; I am not leaving off the 5, 
Firefox and gedit report it differently.  In fairness to gedit, I am reporting 
the encodings listed in its save-as dialog.  Unfortunately the offending file 
contains specifications that are not mine.  I have seen pieces of it published 
elsewhere (quite recently in fact) but will need to do some checking on the 
licensing.  I might be able to excerpt the file and end up with the same 
behavior.

Bill


________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Henrik Johansen 
[[email protected]]
Sent: Friday, July 23, 2010 7:39 AM
To: [email protected]
Subject: Re: [Pharo-project] Invalid utf8 input detected: now what?

On Jul 23, 2010, at 4:09 30AM, Schwab,Wilhelm K wrote:

> Hello all,
>
> I got an error (on Ubuntu 9.10) trying open an old text file that I created 
> on Windows some time ago.  The encoding (if gedit's save-as dialog can be 
> trusted??) is Western ISO-8859-15; resaving as utf8 lets me read it.
>
> So, is Pharo working by design?  Did I do the correct/only thing needed to 
> read the file?  What should I be asking?  Is there anything I can do to turn 
> this into a useful test/debugging example?
>
> Bill
>

This is not an error per se, seeing as the encoding is not utf8 :)

If the import was done from some tool instead of in your code (in which case 
you'd set the encoding of the file stream), a nicer *behavior* might be for the 
UI Manager to catch encoding errors when trying to read a file, and offer up a 
dialogue with a list of encodings which the file *can* be read as, along with a 
preview window of what the text would look like with the selected encoding, 
like some word processors do.

Cheers,
Henry
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to