[issue18105] ElementTree writes invalid files when UTF-16 encoding is specified

Adam Urban report at bugs.python.org
Fri May 31 08:54:16 CEST 2013


New submission from Adam Urban:

import xml.etree.ElementTree as ET
tree = ET.parse("myinput.xml")
tree.write("myoutput.xml", encoding="utf-16")

...Output is a garbled mess, often a mix of UTF-8 and UTF-16 bytes... UTF-8 output works fine, but when UTF-16, UTF-16LE, or UTF-16BE are specified the output is mangled.

----------
components: Unicode, XML
messages: 190392
nosy: Adam.Urban, ezio.melotti
priority: normal
severity: normal
status: open
title: ElementTree writes invalid files when UTF-16 encoding is specified
type: behavior
versions: 3rd party, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18105>
_______________________________________


More information about the Python-bugs-list mailing list