diff options
-rw-r--r-- | Lib/test/test_sax.py | 7 | ||||
-rw-r--r-- | Lib/xmlcore/sax/saxutils.py | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index ded81fb2b5..246d214d6a 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -175,11 +175,14 @@ def test_xmlgen_attr_escape(): gen.endElement("e") gen.startElement("e", {"a": "'\""}) gen.endElement("e") + gen.startElement("e", {"a": "\n\r\t"}) + gen.endElement("e") gen.endElement("doc") gen.endDocument() - return result.getvalue() == start \ - + "<doc a='\"'><e a=\"'\"></e><e a=\"'"\"></e></doc>" + return result.getvalue() == start + ("<doc a='\"'><e a=\"'\"></e>" + "<e a=\"'"\"></e>" + "<e a=\" 	\"></e></doc>") def test_xmlgen_ignorable(): result = StringIO() diff --git a/Lib/xmlcore/sax/saxutils.py b/Lib/xmlcore/sax/saxutils.py index 582b0089c4..a4965192fa 100644 --- a/Lib/xmlcore/sax/saxutils.py +++ b/Lib/xmlcore/sax/saxutils.py @@ -68,6 +68,8 @@ def quoteattr(data, entities={}): the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. """ + entities = entities.copy() + entities.update({'\n': ' ', '\r': ' ', '\t':'	'}) data = escape(data, entities) if '"' in data: if "'" in data: |