There is a related bug report on LP (with a controversial discussion) about the issue (can't find the URL right now). Andreas On 21.08.09 21:40, Chris Withers wrote:
Hi All,
I'm suffering with two different types of UnicodeDecodeError with a Zope 2.12 project...
The first type of problem occurs when a form is submitted and the form fields contain encoded strings. Somewhere down the line I get:
Module zope.i18n, line 166, in interpolate Module zope.i18n, line 161, in replace UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)
So, my question is how do I get strings submitted to the publisher (ideally) end up as unicode objects not encoded strings? Failing that, how do I find out what encoding the browser has provided?
The second type of problem only occurs in IE and Safari, where viewing a page that contains some non-ascii-able data:
Module ZPublisher.Publish, line 127, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 47, in call_object Module Products.Five.browser.metaconfigure, line 427, in __call__ Module Products.Five.browser.pagetemplatefile, line 126, in __call__ Module Products.Five.browser.pagetemplatefile, line 60, in __call__ Module zope.pagetemplate.pagetemplate, line 116, in pt_render - Warning: Macro expansion failed - Warning: <class 'zope.tal.taldefs.METALError'>: macro nesting limit (100) exceeded by u'root/standard_template.pt/macros/nav' Module StringIO, line 270, in getvalue UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)
Two things are weird here:
- Why am I getting a macro nesting limit? This seems to be a recurring problem (excuse the pun) with Zope 2.12 page templates where if there's an error in a standard template, I get this error when a template that uses it is rendered.
- 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?
cheers,
Chris
-- ZOPYX Ltd. & Co KG \ ZOPYX & Friends Charlottenstr. 37/1 \ The experts for your Python, Zope and D-72070 Tübingen \ Plone projects www.zopyx.com, info@zopyx.com \ www.zopyx.de/friends, friends@zopyx.de ------------------------------------------------------------------------ E-Publishing, Python, Zope & Plone development, Consulting