[Zope] character encoding

Eric Bréhault ebrehault at gmail.com
Fri Nov 9 05:21:56 EST 2007


Hello,

Add a file named sitecustomize.py in python_path/lib/python/site-packages
with the following code:
import sys
sys.setdefaultencoding('UTF-8')

restart zope and it should fix your problem

Eric


On Nov 9, 2007 10:59 AM, adam molyneaux <adam.molyneaux at bluewin.ch> wrote:

> Hi
>
> I am currently having problems sorting out utf8 encoding through the
> following chain of events, and I would GREATLY
> appreciate any help anyone can offer.  I need to do the following, in a
> Zope 2.9.2-, python 2.4.3 setup (I have also
> tried this on Zope 2.10.4 with the uniocode patch for MySQLDA and get
> slightly different equally annoying results).
>
>
> 1. Read and parse a file encoded as utf8 - currently done with an external
> script
> 2. send it to a page to edit as utf8
> 3. save it from the page into a mysql database as utf8
>
>
> This is slightly complicated by the fact that steps 2 and 3 need to happen
> via XMLHttpRequest calls, and the data is
> sent serialized as JSON
>
> Anyone done anything similar with success ?
>
> Currently when I export stuff from my database for the end client I am
> having to change %uXXXX in the text into \uXXXX
> then decode the string as 'latin1', further decode it as 'unicode_escape',
> then recode it as 'utf8'.
>
> This seems slightly 'dangerous'.
>
> Thanks for any help - this has cost me far too much time already.
>
>
> Adam
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20071109/1cf478f0/attachment.htm


More information about the Zope mailing list