[Zope] Unicode Error
Dieter Maurer
dieter@handshake.de
Thu, 31 Oct 2002 21:27:22 +0100
Juan Manuel Ruiz Garcia writes:
> I'm getting this error since I upgraded to Zope 2.6 (from 2.3). Formerly,
> everything was going ok. What can be the problem??:
>
> Traceback (innermost last):
> ...
> Module Script (Python), line 32, in marcaResultados
> - <PythonScript at /jmruiz/1X2/marcaResultados>
> - Line 32
> UnicodeError: ASCII encoding error: ordinal not in range(128)
Somehow you get a unicode string and implicitly convert it into
a normal string.
Python uses the "defaultencoding" for such conversions.
If it is not specified in "sitecustomize.py", Python
uses ASCII encoding. Thus, when you unicode string contains
a non-ASCII character, you get the above exception.
As you live in a Western country, you probably should set
"sys.setdefaultencoding('iso-8859-1')" in your
"sitecustomize.py".
Dieter