I have a number of scripts which get external data and update parts of xml files.
I use lxml in my python script and it saves character references in decimal notation, for example:
$ cat input.xml
<data>
<record text="Привет">
</record>
</data>
$ python
>>> from lxml import etree
>>> tree = etree.parse("input.xml")
>>> tree.write("out.xml")
$ cat out.xml
<data>
<record text="Привет">
</record>
</data>
While other scripts use hex form: <record text="Привет">
and so there are endless series of changes in git for these files even if there are no actual changes.
How can I tell lxml to save character references in hex form (П
) in a python script?