[ python-Bugs-1767933 ] Badly formed XML using etree and utf-16

SourceForge.net noreply at sourceforge.net
Sun Aug 5 17:01:57 CEST 2007


Bugs item #1767933, was opened at 2007-08-05 18:01
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1767933&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: BugoK (bugok)
Assigned to: Nobody/Anonymous (nobody)
Summary: Badly formed XML using etree and utf-16

Initial Comment:
Hello,

The bug occurs when writing an XML file using the UTF-16 encoding.
The problem is that the etree encodes every string to utf-16 by itself - meaning, inserting the 0xfffe BOM before every string (tag, text, attribute name, etc.), causing a badly formed utf=16 strings.

A possible solution, which was offered by a co-worker of mine, was to use a utf-16 writer (from codecs.getwriter('utf-16') to write the file.

Best,

BugoK.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1767933&group_id=5470


More information about the Python-bugs-list mailing list