[Zope] *Error Type: UnicodeDecodeError*

Dieter Maurer dieter at handshake.de
Mon Mar 21 13:31:30 EST 2005


jose wrote at 2005-3-21 17:01 +0100:
> ...
>>Your options:
>>
>>     *  use the "unicode" function to convert "data[0]..."
>>        to unicode.
>>
>>	You must provide the correct encoding as second
>>	argument (otherwise, you get the same error).
>>
>>     *  change Python's "defaultencoding" with
>>        "sys.setdefaultencoding(the_encoding)".
>>
>>        This is only possible at startup (usually done
>>	in "sitecustomize.py".
>>
>>	Unicode fanatics do not like this solution...
>>
>>  
>>
>I would like to follow your tip by changing sitecustomize.py but I am 
>fear that a such global configuration maybe will change some unwanted 
>behavior in other Zope modules.
>Could you ensure me there are no collateral effect with other modules?

I use a "sitecustomize" with "sys.setdefaultencoding('iso-8859-15')"
since ages.

Up to now, I met a single problem:

  It triggered a bug in Python's "xmlrpclib".
  "xmlrpmlic" wrongfully assumes that "str(unicode)"
  either converts to 7 bit ascii or raises an exception.
  This is only true for 'ascii' as default encoding.

  This bug will be fixed in Python 2.4.1.

Thus, I can tell you for sure: there is buggy
software around that gets confused if "defaultencoding"
is not "ascii".


-- 
Dieter


More information about the Zope mailing list