diff options
author | Philipp von Weitershausen <philipp@weitershausen.de> | 2007-01-14 13:54:17 +0000 |
---|---|---|
committer | Philipp von Weitershausen <philipp@weitershausen.de> | 2007-01-14 13:54:17 +0000 |
commit | ae8fd91d9ee289f31a30cc7a435fd077dface481 (patch) | |
tree | dc75ea1e8c7f3b108b78c090bb9bbf6df0f6d47c /xmlparser.py | |
parent | 1dd9649c77ec7ddc0a8ce2d0029e43d9c112e1ad (diff) | |
download | zope-tal-ae8fd91d9ee289f31a30cc7a435fd077dface481.tar.gz |
Merge from 3.3 branch:backups/monolithic-zope3@75193
------------------------------------------------------------------------
r72022 | philikon | 2007-01-14 14:45:26 +0100 (Sun, 14 Jan 2007) | 5 lines
zope.tal.xmlparser.XMLParser couldn't deal with unicode strings, which meant that
PageTemplates in XML mode whose source code was available as a unicode string failed.
Fixed the problem and added a test that exercises a PT w/ unicode source in XML mode
(HTML mode already worked).
------------------------------------------------------------------------
Diffstat (limited to 'xmlparser.py')
-rw-r--r-- | xmlparser.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/xmlparser.py b/xmlparser.py index 593bcbe..aafa693 100644 --- a/xmlparser.py +++ b/xmlparser.py @@ -74,6 +74,11 @@ class XMLParser(object): self.parseStream(open(filename)) def parseString(self, s): + if isinstance(s, unicode): + # Expat cannot deal with unicode strings, only with + # encoded ones. Also, its range of encodings is rather + # limited, UTF-8 is the safest bet here. + s = s.encode('utf-8') self.parser.Parse(s, 1) def parseURL(self, url): |