diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-02-09 16:51:16 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-02-09 16:51:16 (GMT) |
commit | c77dd32be4557ad5d2e5c9a710ebeaf52d5092d1 (patch) | |
tree | f77e45403d9f7dc9ad863caacb9928d6fd90fc90 /Lib/test/test_xml_etree.py | |
parent | 28a817e3bacd1de1fbca2d0cd8f2f7dd3cc72b61 (diff) | |
download | cpython-c77dd32be4557ad5d2e5c9a710ebeaf52d5092d1.zip cpython-c77dd32be4557ad5d2e5c9a710ebeaf52d5092d1.tar.gz cpython-c77dd32be4557ad5d2e5c9a710ebeaf52d5092d1.tar.bz2 |
Issue #6233: ElementTree failed converting unicode characters to XML
entities when they could't be represented in the requested output
encoding. Patch by Jerry Chen.
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r-- | Lib/test/test_xml_etree.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 895902f..a7ad48b 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -210,6 +210,17 @@ def check_encoding(ET, encoding): """ ET.XML("<?xml version='1.0' encoding='%s'?><xml />" % encoding) +def check_issue6233(): + """ + >>> from xml.etree import ElementTree as ET + + >>> e = ET.XML("<?xml version='1.0' encoding='utf-8'?><body>t\xe3g</body>") + >>> ET.tostring(e, 'ascii') + b"<?xml version='1.0' encoding='ascii'?>\\n<body>tãg</body>" + >>> e = ET.XML("<?xml version='1.0' encoding='iso-8859-1'?><body>t\xe3g</body>".encode('iso-8859-1')) # create byte string with the right encoding + >>> ET.tostring(e, 'ascii') + b"<?xml version='1.0' encoding='ascii'?>\\n<body>tãg</body>" + """ # # xinclude tests (samples from appendix C of the xinclude specification) |