[Zope] Re: unicode and zope

Andrew Altepeter aaltepet at bethel.edu
Wed Feb 4 10:18:04 EST 2004


(bringing this back on the list...)

Hi Shan,

It appears that the steps you outlined have solved my issue(s) too.

Thanks,
Andy

On Tue, 2004-02-03 at 16:19, Shan Duncan wrote:
> Hi,
> 
> I just went through the exact same issue except it was from ZPT.
> 
> First check the version of python you are runniing zope.
> 
> Second check to see what the default encoding that version of python is 
> using:
> 
> python>import sys
> python>sys.getdefaultencoding()
> python> 'ascii'
> 
> The version of python I was using to run zope returned ascii as the
> default.
> 
> Doing a quick check via google I found this link:
> 
> http://diveintopython.org/xml_processing/unicode.html
> 
>  and added a file called sitecustomize.py to lib/site-packages:
> 
> -----------------------------------------------------------
> 
> # sitecustomize.py                   
> # this file can be anywhere in your Python path,
> # but it usually goes in ${pythondir}/lib/site-packages/
> 
> import sys
> sys.setdefaultencoding('iso-8859-1')
> -----------------------------------------------------------
> 
> (I used iso-8859-1 because I am mainly supporting western european 
> languages.  There is no reason why you could not use another encoding).
> 
> and restart zope so python uses your new default encoding and you should
> be ok.  This at least is my understanding of the quick and easy fix.  You
> can go with other methods such as localizer but that might be more work
> for now.  The plone site at plone.org has a discussion of unicode too.
> 
> I have had folks from Mexico save and upload information via a forulator
> form to and from a mysql database today without any problems so far.
> 
> Good luck!
> 
> Cheers,
> 
> -Shan
> 
> 




More information about the Zope mailing list