After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 392300 - Expose the encoding of an XML document in Python binding
Expose the encoding of an XML document in Python binding
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: python
2.6.22
Other All
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2007-01-03 13:37 UTC by Jean Jordaan
Modified: 2021-07-05 13:27 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Jean Jordaan 2007-01-03 13:37:44 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'
Comment 1 GNOME Infrastructure Team 2021-07-05 13:27:31 UTC
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.