mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Implement the encoding argument for toxml and toprettyxml.
Document toprettyxml.
This commit is contained in:
parent
2ebfd09e58
commit
7d650ca83b
5 changed files with 68 additions and 9 deletions
|
|
@ -606,6 +606,14 @@ def testSAX2DOM():
|
|||
|
||||
doc.unlink()
|
||||
|
||||
def testEncodings():
|
||||
doc = parseString('<foo>€</foo>')
|
||||
confirm(doc.toxml() == u'<?xml version="1.0" ?>\n<foo>\u20ac</foo>'
|
||||
and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?>\n<foo>\xe2\x82\xac</foo>'
|
||||
and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?>\n<foo>\xa4</foo>',
|
||||
"testEncodings - encoding EURO SIGN")
|
||||
doc.unlink()
|
||||
|
||||
# --- MAIN PROGRAM
|
||||
|
||||
names = globals().keys()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue