Umlauts revisited: Now they prevent program from running

Dieter Maurer dieter at handshake.de
Mon Jan 29 14:55:23 EST 2001


"Franz GEIGER" <fgeiger at datec.at> writes on Fri, 26 Jan 2001 14:11:20 +0100:
> I pull data out of an Excel sheet using DAO. There are field values
> containing text strings. Everything works fine until a text reads e.g.
> "Stück".
> 
> After stopping before the exception
> 
> "UnicodeError: ASCII encoding error: ordinal not in range(128)"
> 
> occurs I display the field in the interactive window of PythonWin
> (ActiveState 2.0 on NT4) by simply typing "fld.Value".
> 
> It displays u'St\374ck'.
> 
> Conversion into a Python string by applying print or str() yields:
> 
> "Traceback (innermost last):
>   File "<interactive input>", line 1, in ?
> UnicodeError: ASCII encoding error: ordinal not in range(128)"
> 
> Any idea how to overcome this?
Inside your "site.py" you can change the default encoding
with "sys.setDefaultEncoding" to something appropriate for
you.

You will find more details by searching the archive of c.l.p.


Dieter



More information about the Python-list mailing list