How to ask sax for the file encoding

"Martin v. Löwis" martin at v.loewis.de
Wed Oct 4 16:50:18 EDT 2006


Edward K. Ream schrieb:
> Can anyone tell me how the content handler can determine the encoding of the 
> file?  Can sax provide this info?

That's not supported in SAX. If you use Expat directly (module pyexpat),
you can set the XmlDeclHandler, which is called when the XML declaration
is received (with the parameters version, encoding, and standalone).
However, as the XML declaration is optional, this callback might
not get invoked.

Regards,
Martin



More information about the Python-list mailing list