Suspected Unicode problem when reading text from Excell

Fredrik Lundh fredrik at
Thu Sep 6 18:04:05 CEST 2001

Marcin 'Qrczak' Kowalczyk wrote:

> This is a great evidence that the default encoding should be the one
> specified in the locale, not ASCII.

the default encoding affects *all* operations.

making operations like L.sort() and str(S) dependent on the host
platform is a really lousy idea.

(I think it's more likely that setdefaultencoding will go away in
a not too distant future.  like -U, it was added to make it easy
for the python-dev team to experiment; not for daily use by
application developers...)

> Second, it would avoid a wrong fix which assumes that everybody uses
> Latin1. Well, it's probably not wrong in this context, but the general
> solution currently is not: set the default encoding to Latin1, but:
> set the default encoding to the system's default.

what you really want is to set stdout/stderr/stdin to convert
unicode strings based on the current locale, but leave all other
operations alone.

(and I'm pretty sure Python will do that for you in a near future)


More information about the Python-list mailing list