[Zope] character encoding

adam molyneaux adam.molyneaux at bluewin.ch
Fri Nov 9 04:59:02 EST 2007


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.


More information about the Zope mailing list