Umlauts revisited: Now they prevent program from running

Alex Martelli aleaxit at yahoo.com
Fri Jan 26 08:28:39 EST 2001


"Franz GEIGER" <fgeiger at datec.at> wrote in message
news:94rt05$tbe$1 at newsreaderg1.core.theplanet.net...
    [snip]
> (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?

try, for example, using fld.Value.encode('iso-8859-1') -- that
should return the Python string you desire, i.e. 'St\374ck'.


Alex






More information about the Python-list mailing list