Martin Panter added the comment: Here is a patch which changes the code to respect the letter case specified by the user, although it still compares the special strings "unicode", "us-ascii", and "utf-8" case-insensitively, and the default encoding is still lowercase. Let me know what you think.
>>> tree = ElementTree(Element('hello', {'beer': 'good'})) >>> tree.write(stdout.buffer, encoding="UTF-8", xml_declaration=True); print() <?xml version='1.0' encoding='UTF-8'?> <hello beer="good" /> >>> tree.write(stdout.buffer, encoding="UTF-8"); print() <hello beer="good" /> >>> tree.write(stdout.buffer, xml_declaration=True); print() <?xml version='1.0' encoding='us-ascii'?> <hello beer="good" /> ---------- keywords: +patch stage: needs patch -> patch review Added file: http://bugs.python.org/file40496/etree-encoding.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25047> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com