diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-05-12 14:31:59 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-05-12 14:31:59 (GMT) |
commit | 3068aed92bb7557cdef7e18a4a02ddff2dc1ad0b (patch) | |
tree | c2458b5ff8986edc481aa40300c93cf24030e437 /Lib/xml | |
parent | 7025349aa8c09f6910ca985d72a059019129d1f8 (diff) | |
parent | 3eab6b363a968e907605fe749d12941c3be29761 (diff) | |
download | cpython-3068aed92bb7557cdef7e18a4a02ddff2dc1ad0b.zip cpython-3068aed92bb7557cdef7e18a4a02ddff2dc1ad0b.tar.gz cpython-3068aed92bb7557cdef7e18a4a02ddff2dc1ad0b.tar.bz2 |
Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
characters() and ignorableWhitespace() methods. Original patch by Sebastian
Ortiz Vasquez.
Diffstat (limited to 'Lib/xml')
-rw-r--r-- | Lib/xml/sax/saxutils.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py index 0798ecd..74de9b0 100644 --- a/Lib/xml/sax/saxutils.py +++ b/Lib/xml/sax/saxutils.py @@ -209,11 +209,15 @@ class XMLGenerator(handler.ContentHandler): def characters(self, content): if content: self._finish_pending_start_element() + if not isinstance(content, str): + content = str(content, self._encoding) self._write(escape(content)) def ignorableWhitespace(self, content): if content: self._finish_pending_start_element() + if not isinstance(content, str): + content = str(content, self._encoding) self._write(content) def processingInstruction(self, target, data): |