[ python-Bugs-1281032 ] xml.sax.expatreader doesn't pass encoding to ParserCreate
SourceForge.net
noreply at sourceforge.net
Sat Sep 3 00:14:52 CEST 2005
Bugs item #1281032, was opened at 2005-09-02 22:14
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1281032&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: XML
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Samuel Bayer (sambayer)
Assigned to: Nobody/Anonymous (nobody)
Summary: xml.sax.expatreader doesn't pass encoding to ParserCreate
Initial Comment:
The ParserCreate function in the expat module accepts an encoding
argument, presumably for use when the encoding is not provided in
the XML document. This function is invoked by the reset() method of
the ExpatParser class in xml.sax.expatreader. The encoding, if
provided, is available from the InputSource object stored in the
self._source variable, but the value is not passed along to
ParserCreate. This bug is present in Python 2.4.1.
I believe the correct fix is to change lines 246 and 247 in Lib/xml/
sax/expatreader.py from
self._parser = expat.ParserCreate(None, " ",
intern=self._interning)
to
self._parser = expat.ParserCreate(self._source.getEncoding
(), " ",
intern=self._interning)
and line 252 from
self._parser = expat.ParserCreate(intern = self._interning)
to
self._parser = expat.ParserCreate(self._source.getEncoding
(), intern = self._interning)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1281032&group_id=5470
More information about the Python-bugs-list
mailing list