mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Normalize the encoding names for Latin-1 and UTF-8 to
'latin-1' and 'utf-8'. These are optimized in the Python Unicode implementation to result in more direct processing, bypassing the codec registry. Also see issue11303.
This commit is contained in:
parent
a391b11320
commit
8f36af7a4c
32 changed files with 84 additions and 79 deletions
|
@ -22,7 +22,7 @@ from xml.etree import ElementTree as ET
|
|||
|
||||
SIMPLE_XMLFILE = findfile("simple.xml", subdir="xmltestdata")
|
||||
try:
|
||||
SIMPLE_XMLFILE.encode("utf8")
|
||||
SIMPLE_XMLFILE.encode("utf-8")
|
||||
except UnicodeEncodeError:
|
||||
raise unittest.SkipTest("filename is not encodable to utf8")
|
||||
SIMPLE_NS_XMLFILE = findfile("simple-ns.xml", subdir="xmltestdata")
|
||||
|
@ -1255,8 +1255,8 @@ def processinginstruction():
|
|||
|
||||
>>> ET.tostring(ET.PI('test', '<testing&>'))
|
||||
b'<?test <testing&>?>'
|
||||
>>> ET.tostring(ET.PI('test', '<testing&>\xe3'), 'latin1')
|
||||
b"<?xml version='1.0' encoding='latin1'?>\\n<?test <testing&>\\xe3?>"
|
||||
>>> ET.tostring(ET.PI('test', '<testing&>\xe3'), 'latin-1')
|
||||
b"<?xml version='1.0' encoding='latin-1'?>\\n<?test <testing&>\\xe3?>"
|
||||
"""
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue