mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
characters() and ignorableWhitespace() methods. Original patch by Sebastian Ortiz Vasquez.
This commit is contained in:
commit
3068aed92b
4 changed files with 27 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue