[Python-3000] locale-aware strings ?

Brian Quinlan brian at sweetapp.com
Tue Sep 5 20:12:15 CEST 2006

Guido van Rossum wrote:
> And it seems just as wrong if Python doesn't do what the user expects.
> If I were a beginning Python user, I'd hate it if I had prepared a
> simple data file in vi or notepad and my Python program wouldn't read
> it right because Python's idea of encoding differs from my editor's.

As a user, I don't have any expectations regarding non-ASCII text files.

I'm using a US-English version of Windows XP (very common) and I haven't 
changed the default encoding (very common). Python claims that my system 
encoding is CP436 (from sys.stdin/stdout.encoding). I can assure you 
that most of the documents that I work with are not in CP436 - they are 
a combination of ASCII, ISO8859-1, and UTF-8. I would also guess that 
this is true of many Windows XP (US-English) users. So, for me and users 
like me, Python is going to silently misinterpret my data.

How about using ASCII as the default encoding and raising an exception 
if non-ASCII text is encountered?


More information about the Python-3000 mailing list