New submission from David Buxton:
The problem is an inconsistency between the ElementTree.write() method on
Python 2 and 3 when xml_declaration is True. For Python 2.7 the encoding
argument MUST NOT be a unicode string. For Python 3.2 the encoding argument
MUST be a unicode string.
On Python
David Buxton added the comment:
A patch against the current default branch to add tests for the xml_declaration
keyword argument. This passes when applied to the 2.7 branch too.
This does NOT test whether one can use both bytes/unicode for the encoding
argument. It just uses the native string
David Buxton added the comment:
Only a problem because I am using unicode_literals and it didn't occur to me to
use `str('utf-8')` to get a native string on both 2+3. Much the best solution,
thank you.
But that is still a little smelly - I think what I want ideally is for
ElementTree