Commit d3ac565d authored by Andreas Jung's avatar Andreas Jung

- Collector #151020: HTTP_CHAR_SET headers containing 'x-user-defined'

        caused a LookupError exception. Unknown encodings are from now on
        silently discarded.
parent 7190bb0f
......@@ -29,6 +29,10 @@ Zope Changes
- Collector #2339: ZPT: fixed unicode issue when using the 'structure'
directive
- Collector #151020: HTTP_CHAR_SET headers containing 'x-user-defined'
caused a LookupError exception. Unknown encodings are from now on
silently discarded.
Zope 2.10.4 (2007/06/23)
Other changes
......
......@@ -131,6 +131,15 @@ class ZPTUnicodeEncodingConflictResolution(ZopeTestCase):
result = zpt.pt_render()
self.assertEqual(result.startswith(unicode('<div></div>', 'iso-8859-15')), True)
def testBug151020(self):
manage_addPageTemplate(self.app, 'test',
text='<div tal:content="python: request.get(\'data\')" />',
encoding='ascii')
zpt = self.app['test']
self.app.REQUEST.set('HTTP_ACCEPT_CHARSET', 'x-user-defined, iso-8859-15')
self.app.REQUEST.set('data', unicode('', 'iso-8859-15').encode('utf-8'))
result = zpt.pt_render()
self.assertEqual(result.startswith(unicode('<div></div>', 'iso-8859-15')), False)
class ZopePageTemplateFileTests(ZopeTestCase):
......
......@@ -84,7 +84,7 @@ class PreferredCharsetResolver:
try:
return unicode(text, enc)
except UnicodeDecodeError:
except (LookupError, UnicodeDecodeError):
pass
return text
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment