[issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding

2017-06-27 Thread STINNER Victor
STINNER Victor added the comment: I lost track of this change. I'm not sure why I proposed it, and I don't feel confortable to change the ElementTree code :-/ I fear a regression, so I prefer to abandon my change. -- resolution: -> out of date stage: -> resolved status: open ->

[issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding

2016-09-05 Thread STINNER Victor
STINNER Victor added the comment: New patch: * Avoid codecs.lookup() for method != "xml" * More unit tests -- Added file: http://bugs.python.org/file44385/etree_xml_declaration-2.patch ___ Python tracker

[issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding

2016-09-02 Thread Stefan Behnel
Stefan Behnel added the comment: > By the way, I'm surprised that the special encoding "unicode" relies on the > *current* locale encoding when the XML declaration is requested. That seems a weird choice. Since it serialises to a Unicode string, it shouldn't have any XML declaration at all,

[issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding

2016-09-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > By the way, I'm surprised that the special encoding "unicode" relies on the > *current* locale encoding when the XML declaration is requested. Why not > alway susing UTF-8 for *unicode* instead of the locale encoding? Because it is usually outputs to

[issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding

2016-09-02 Thread STINNER Victor
STINNER Victor added the comment: Note: I found the "us-ascii" special case when reviewing the issue #27915 which proposed to replace "us-ascii" with "ascii" in the xml.etree module to use the Python fast-path for performance. -- ___ Python tracker

[issue27940] xml.etree: Avoid XML declaration for the "ascii" encoding

2016-09-02 Thread STINNER Victor
New submission from STINNER Victor: The ElementTree module (xml.etree) avoids the XML declaration for "utf-8" and "us-ascii" codecs, but not for the "ascii" encoding. Attached patch avoids the XML declaration for the "ascii" codec since it's a subset of UTF-8 and UTF-8 is the default encoding