[Zope] Plagued by UnicodeEncodeError and UnicodeDecodeError

Dieter Maurer dieter at handshake.de
Sat Jan 22 13:23:11 EST 2005


davelists2 at peoplemerge.com wrote at 2005-1-21 16:58 -0800:
>We have a ton of AT objects ...
> ...
>UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 
>5: ordinal not in range(128).  
>
>The traceback shows the field which is causing the error, and I don't 
>see any unicode chars there!

The current Archetypes has a strange handling of text data:

    Internally, it stores it as unicode (good!)
    but it tries hard to deliver the content encoded.
    I am not even sure, there is a way to tell it to deliver
    unicode; but at least you can pass in the encoding your
    want ("encoding" keyword argument).

AT 1.3.1 uses "instance.getCharset()" as "encoding", if not
specified explicitely. This is better than previous versions
that used the "original encoding" (which could mix different
encodings in a single page).


By the way: the Archetypes mailing lists are probably better
suited to discuss Archetype related questions.

-- 
Dieter


More information about the Zope mailing list