[Zope-dev] UnicodeDecodeError problems with Zope 2.12.0b4
Chris Withers
chris at simplistix.co.uk
Tue Aug 25 12:21:02 EDT 2009
Takayuki Shimizukawa wrote:
> 2009/8/22 Chris Withers <chris at simplistix.co.uk>:
>> The first type of problem occurs when a form is submitted and the form
>> fields contain encoded strings. Somewhere down the line I get:
>
> The first type, I don't know.
>
>> The second type of problem only occurs in IE and Safari, where viewing a
>> page that contains some non-ascii-able data:
>
> The second type, (maybe) similer probrem reported to launchpad.
> https://bugs.launchpad.net/zope2/+bug/160968
>
>> - Why am I getting this decoding error only with these browsers? Firefox
>> and Chrome work just fine... Is the publisher doing something special
>> with a header these browsers send that IE and Safari are not? If so, how
>> do I make it do the "right thing" for IE and Safari?
>
> Are concerned that HTTP_ACCEPT_CHARSET http header will probably
> not be sent from client browser (IE6,7, Safari).
> When HTTP_ACCEPT_CHARSET not in HTTP request headers,
> zope.publisher use UTF-8 encoding for publishing.
Well, I just solved the problem with a large setdefaultencoding hammer :-)
Annoyingly, this required even more evil, since sitecustomize.py is no
longer found anywhere sensible in Python 2.5, so I ended up with a
buildout that looks like the following:
[buildout]
parts = instance
extends =
http://svn.zope.org/*checkout*/Zope/tags/2.12.0b4/versions.cfg?rev=102515
versions = versions
[versions]
zope2 = 2.12.0b4
[instance]
recipe = zc.recipe.egg
eggs = ${buildout:eggs}
interpreter = py
entry-points=
runzope=Zope2.Startup.run:run
zopectl=Zope2.Startup.zopectl:main
scripts = runzope zopectl
initialization =
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
sys.argv[1:1] = ['-C','${buildout:directory}/etc/instance.conf']
Evil huh? ;-)
Hope this helps someone...
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope-Dev
mailing list