Commit f08beab6 authored by Andreas Jung's avatar Andreas Jung

      - Launchpad #151020: HTTP_CHAR_SET headers containing 'x-user-defined'
        caused a LookupError exception. Unknown encodings are from now on
        silently discarded.
parent cbcaebbc
...@@ -175,6 +175,10 @@ Zope Changes ...@@ -175,6 +175,10 @@ Zope Changes
Bugs Fixed Bugs Fixed
- Launchpad #151020: HTTP_CHAR_SET headers containing 'x-user-defined'
caused a LookupError exception. Unknown encodings are from now on
silently discarded.
- Launchpad #143902: Fixed App.ImageFile to use a stream iterator to - Launchpad #143902: Fixed App.ImageFile to use a stream iterator to
output the file. Avoid loading the file content when guessing the output the file. Avoid loading the file content when guessing the
mimetype and only load the first 1024 bytes of the file when it cannot mimetype and only load the first 1024 bytes of the file when it cannot
......
...@@ -131,6 +131,15 @@ class ZPTUnicodeEncodingConflictResolution(ZopeTestCase): ...@@ -131,6 +131,15 @@ class ZPTUnicodeEncodingConflictResolution(ZopeTestCase):
result = zpt.pt_render() result = zpt.pt_render()
self.assertEqual(result.startswith(unicode('<div></div>', 'iso-8859-15')), True) self.assertEqual(result.startswith(unicode('<div></div>', 'iso-8859-15')), True)
def testBug151020(self):
manage_addPageTemplate(self.app, 'test',
text='<div tal:content="structure python: %s" />' % "''",
encoding='iso-8859-15')
zpt = self.app['test']
self.app.REQUEST.set('HTTP_ACCEPT_CHARSET', 'x-user-defined, iso-8859-15,utf-8')
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')), True)
class ZopePageTemplateFileTests(ZopeTestCase): class ZopePageTemplateFileTests(ZopeTestCase):
......
...@@ -84,7 +84,7 @@ class PreferredCharsetResolver: ...@@ -84,7 +84,7 @@ class PreferredCharsetResolver:
try: try:
return unicode(text, enc) return unicode(text, enc)
except UnicodeDecodeError: except (LookupError, UnicodeDecodeError):
pass pass
return text 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