
Stefan.Loidl at lrz
Apr 5, 2012, 5:18 AM
Post #2 of 3
(363 views)
Permalink
|
My workaround is for unicodeconflictresolver.py. The diff for Zope 2.13.13 is: 100,101d99 < charsets.append('iso-8859-15') < But as the issue occurs with Am 04.04.2012 16:25, schrieb Yuri: > >> Hi Yuri, >> >> does this error occur with all browsers? > > Yes, unfortunately. > >> I once had a similar issue >> that was caused only by some browsers because they do not send a >> HTTP_ACCEPT_CHARSET header. >> >> Maybe the following bug reports helps you in solving the issue: >> https://bugs.launchpad.net/zope2/+bug/160968 > > I can see it, but I've 2.12.XX and this should be fixed. This is the > code in http.py: > I'm using Zope 2.13.13 and the issue still occurs with Safari. > def getPreferredCharsets(self): > '''See interface IUserPreferredCharsets''' > charsets = [] > sawstar = sawiso88591 = 0 > header_present = bool(self.request.get('HTTP_ACCEPT_CHARSET')) > for charset in self.request.get('HTTP_ACCEPT_CHARSET', '').split(','): > charset = charset.strip().lower() > > isn't HTTP_ stripped from the request variable name? > > >> I'm using a workaround similar to that in the bug report in my >> environment (Zope 2.13.13 and a mixture of utf-8 and iso8859). >> Without the workaround the issue does still occur for me. > > can you send me your workaround? Maybe it can help :P My workaround is for the file unicodeconflictresolver.py. The diff for Zope 2.13.13 (I never used Zope 2.12) is: 100,101d99 < charsets.append('iso-8859-15') < But as the issue occurs for you with all browsers, I don't think that it will help. > >> Greetings, >> Stefan >> >> Am 03.04.2012 09:40, schrieb Yuri: >>> Hi! >>> >>> I've an Zope application, basically postgres + zpt. >>> >>> The postgres db has been upgraded to 8.5, the data inside is utf-8 >>> (dumped and checkd it), the pg adapeter is the latest, and the "*Z >>> Psycopg 2 Database Connection" is configured to use utf-8.* Zope is >>> 2.12.20 + latest security fix. >>> >>> When I try to do: >>> >>> <span tal:replace="result/?column" /> (result came from an ZSQL method) >>> I get an UnicodeDecodeError: >>> >>> Traceback (innermost last): >>> Module ZPublisher.Publish, line 127, in publish >>> Module ZPublisher.mapply, line 77, in mapply >>> Module ZPublisher.Publish, line 47, in call_object >>> Module Shared.DC.Scripts.Bindings, line 324, in __call__ >>> Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec >>> Module Products.PageTemplates.ZopePageTemplate, line 335, in _exec >>> Module Products.PageTemplates.ZopePageTemplate, line 432, in pt_render >>> Module Products.PageTemplates.PageTemplate, line 80, in pt_render >>> Module zope.pagetemplate.pagetemplate, line 113, in pt_render >>> Module zope.tal.talinterpreter, line 271, in __call__ >>> Module zope.tal.talinterpreter, line 343, in interpret >>> Module zope.tal.talinterpreter, line 888, in do_useMacro >>> Module zope.tal.talinterpreter, line 343, in interpret >>> Module zope.tal.talinterpreter, line 946, in do_defineSlot >>> Module zope.tal.talinterpreter, line 343, in interpret >>> Module zope.tal.talinterpreter, line 533, in do_optTag_tal >>> Module zope.tal.talinterpreter, line 518, in do_optTag >>> Module zope.tal.talinterpreter, line 513, in no_tag >>> Module zope.tal.talinterpreter, line 343, in interpret >>> Module zope.tal.talinterpreter, line 821, in do_loop_tal >>> Module zope.tal.talinterpreter, line 343, in interpret >>> Module zope.tal.talinterpreter, line 821, in do_loop_tal >>> Module zope.tal.talinterpreter, line 343, in interpret >>> Module zope.tal.talinterpreter, line 852, in do_condition >>> Module zope.tal.talinterpreter, line 343, in interpret >>> Module zope.tal.talinterpreter, line 376, in do_startEndTag >>> Module zope.tal.talinterpreter, line 405, in do_startTag >>> Module zope.tal.talinterpreter, line 502, in attrAction_tal >>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 38: >>> ordinal not in range(128) >>> >>> if I do: >>> >>> <span tal:replace="python:str(result['column']).decode('utf-8')" /> it >>> works. (I use str because I've also dates in the record, otherwise I >>> could not decode being it not a string) >>> >>> I've several zpt to fix, and I would like it to work as it should. My >>> analisys is that result['column'] is seen as a plain string with \xx >>> characters inside, and decode just transform it in something that Zope >>> recognize as utf-8 when it prints it. >>> >>> Anyway, any idea? >>> _______________________________________________ >>> Zope maillist - Zope [at] zope >>> https://mail.zope.org/mailman/listinfo/zope >>> ** No cross posts or HTML encoding! ** >>> (Related lists - >>> https://mail.zope.org/mailman/listinfo/zope-announce >>> https://mail.zope.org/mailman/listinfo/zope-dev ) > _______________________________________________ Zope maillist - Zope [at] zope https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
|