[issue9522] xml.etree.ElementTree forgets the encoding

2013-01-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
versions: +Python 3.4 -Python 3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2012-07-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2010-08-12 Thread Stefan Behnel

Stefan Behnel  added the comment:

That's why I mention it here to prevent future incompatibilities between the 
two libraries.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2010-08-12 Thread Mark Summerfield

Mark Summerfield  added the comment:

I don't see how lxml is relevant here? lxml is a third party library, whereas 
etree is part of the standard library. And according to the 3.1.2 docs etree 
doesn't have a docinfo (or any other) property.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2010-08-12 Thread Stefan Behnel

Stefan Behnel  added the comment:

lxml.etree has encapsulated this in a 'docinfo' property which also holds the 
XML 'version', the 'standalone' state and the DOCTYPE (if available).

Note that this information is readily available in lxml.etree for any parsed 
Element (by wrapping it in a new ElementTree), but not in ET where it can only 
be associated to the ElementTree instance that did the parsing, not one that 
just wraps a parsed tree of Element objects. I would expect that this is still 
enough to handle this use case, though.

Stefan

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2010-08-12 Thread Mark Summerfield

Mark Summerfield  added the comment:

Perhaps a useful compromise would be to add an "encoding" attribute that is set 
to the encoding of the XML file that's read in (and with a default of "ascii").

That way it would be possible to preserve the encoding, e.g.:

import xml.etree.ElementTree as etree
xml_tree = etree.ElementTree(in_filehandle)
# process the tree
xml_tree.write(out_filehandle, encoding=xml_tree.encoding)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2010-08-08 Thread Stefan Behnel

Stefan Behnel  added the comment:

I think it makes sense to keep input and output separate. After all, the part 
of the software that outputs a document doesn't necessarily know how it came 
in, so having the default output encoding depend on the input sounds error 
prone. Encoding should always be explicit. My advice is to reject this feature 
request.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2010-08-06 Thread Florent Xicluna

Changes by Florent Xicluna :


--
nosy: +scoder

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2010-08-06 Thread Florent Xicluna

Florent Xicluna  added the comment:

It behaves as documented. Moved to "feature request".
http://docs.python.org/library/xml.etree.elementtree.html

--
components: +XML
type: behavior -> feature request
versions: +Python 3.2, Python 3.3 -Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2010-08-05 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +effbot, flox

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9522] xml.etree.ElementTree forgets the encoding

2010-08-05 Thread Mark Summerfield

New submission from Mark Summerfield :

If you read in an XML file that specifies its encoding and then later on use 
xml.etree.ElementTree.write(), it is always written using US-ASCII. 

I think the behaviour should be different:
(1) If the XML that was read included an encoding, that encoding should be 
remembered and used when writing.
(2) If there is no encoding the default for writing should be UTF-8 (which is 
the standard for XML files).
(3) For non-XML files use US-ASCII.

Naturally, any of these could be overridden using an encoding argument to the 
write() method.

--
components: Library (Lib)
messages: 112962
nosy: mark
priority: normal
severity: normal
status: open
title: xml.etree.ElementTree forgets the encoding
type: behavior
versions: Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com