[Zope] utf-8 problem in Zope when using Localizer

Patrick Ulmer ulmer at truckport.de
Fri Aug 24 04:26:42 EDT 2007


I think I solved the problem.

<dtml-var "MessageCatalog('Hallo Welt!').encode('utf-8')">

works. I read some further and found out that I should use something like

import sys

I set it global in sitecustomize.py under /usr/lib/python2.4/site-packages and then 

<dtml-var "MessageCatalog('Hallo Welt!')">

works. Now I only must find the right place for setdefaultencoding() so
it only affect my zope-instance.


Patrick Ulmer schrieb:
> I think it's the right way for a solution. Now my page is utf-8, but if
> the string returned from MessageCatalog have utf-8 chars and not online
> chars in ascii range I get this error-message:
> Error Type: UnicodeEncodeError
> Error Value: 'ascii' codec can't encode character u'\xf4' in position
> 3: ordinal not in range(128)

More information about the Zope mailing list