On Sat, 11 Feb 2012 18:36:52 -0800, Rick Johnson wrote:

>> "I have a file containing text. I can open it in an editor and see it's
>> nearly all ASCII text, except for a few weird and bizarre characters
>> like £ © ± or ö. In Python 2, I can read that file fine. In Python 3 I
>> get an error. What should I do that requires no thought?"
>>
>> Obvious answers:
> 
> the most obvious answer would be to read the file WITHOUT worrying about
> asinine encoding.

Your mad leet reading comprehension skillz leave me in awe Rick.

If you try to read a file containing non-ASCII characters encoded using 
UTF8 on Windows without explicitly specifying either UTF8 as the 
encoding, or an error handler, you will get an exception.

It's not just UTF8 either, but nearly all encodings. You can't even 
expect to avoid problems if you stick to nothing but Windows, because 
Windows' default encoding is localised: a file generated in (say) Israel 
or Japan or Germany will use a different code page (encoding) by default 
than one generated in (say) the US, Canada or UK.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to