[Zope3-Users] Unicode and vocabularies

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Oct 30 10:10:47 EST 2006


On Friday 29 September 2006 21:52, Darryl Cousins wrote:
> File "/opt/zope/zope3/src/zope/schema/vocabulary.py", line 41, in
> __init__
>         self.token = str(token)
>     UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
> position 13: ordinal not in range(128)with vocabulary code:
>
> I can't figure out how to get the correct unicode value into the utility
> list and yet still have str(u'é') work when vocabulary factory is
> called.

The token of a vocabulary term *cannot* be a unicode string and must be ASCII. 
In your scenario the default term implementation will not work and you have 
to provide your own, somehow escaping the value to an ASCII string.

Note that this requirement is well-documented in the interfaces of the 
vocabulary.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list