GNOME Bugzilla – Bug 392300
Expose the encoding of an XML document in Python binding
Last modified: 2021-07-05 13:27:31 UTC
I'd like to find the encoding of an XML document, as detected by libxml2, using the Python bindings. Daniel writes (edited for typos and clarity): """[This information is available as] a string attached to the xmlDoc. It's available directly in C but there is no specific API to extract it. As a result the autogenerated bindings don't seem to have a way to extract the information. The simplest way to add this, is probably to provide a custom accessor function, specifically at the python binding level.""" An example of the kind of functionality I'm looking for, using lxml: >>> et <etree._ElementTree object at 0xb7cc992c> >>> et.docinfo.encoding 'windows-1252'
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.