![]() ![]() A complete solution would be to rewrite ElementTree.write() to useĪ different encoding methodology such as StreamWriter. UTF-16BE which do not prepend a BOM, but then the file doesn't have anyīOM. It can be worked around by using UTF-16LE or This is a result of using string.encode() and is a Every write has a BOM, so corrupting the file in a manner analogous There is no work-around except a five-minute hackĢ. Matter of extending the methodology to encode all characters and not Isn't, and the individual etc characters are not. Not all characters in the file are UTF-16. The best workaround for ET 1.2 (Python 2.5) is probably to serialize as "utf-8" and transcode: 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.Ī 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.ĮT's standard serializer currently only supports ASCII-compatible encodings. ![]() The bug occurs when writing an XML file using the UTF-16 encoding. FilesĮtree_write_utf16_without_tests-3.2.patch BreamoreBoy, Richard.Urwin, amaury.forgeotdarc, bugok, effbot, eli.bendersky, flox, nnorwitz, python-dev, rurwin, serhiy.storchakaĬreated on 15:01 by bugok, last changed 14:56 by admin.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |