Suspected Unicode problem when reading text from Excell

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Thu Sep 6 10:35:05 EDT 2001


Thu, 06 Sep 2001 08:54:22 GMT, Ian Parker <parker at gol.com> pisze:

> I encountered this, to my horror, a few weeks ago. My python script was
> just about ready for the big-time, worked perfectly on the test data and
> then bombed with this error when I ran it for real.  To my great relief
> there was  a discussion about this topic at that time in c.l.p.
> 
> You simply need to set your default encoding to "Latin-1", so that you
> can handle the full range of 8-bit characters.

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

First, it would avoid crashing here.

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. And it really should
be: do nothing. it already works with vanilla Python.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list