How to ask sax for the file encoding

Edward K. Ream edreamleo at charter.net
Wed Oct 4 16:48:19 CEST 2006


>> Can anyone tell me how the content handler can determine the encoding of 
>> the file?  Can sax provide this info?

> there is no encoding on the "inside" of an XML document; it's all Unicode.

True, but sax is reading the file, so sax is producing the unicode, so it 
should (must) be able to determine the encoding.  Furthermore, xml files 
start with lines like:

<?xml version="1.0" encoding="utf-8"?>

so it would seem reasonable for sax to be able to return 'utf-8' somehow. 
Am I missing something?

Edward
--------------------------------------------------------------------
Edward K. Ream   email:  edreamleo at charter.net
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------





More information about the Python-list mailing list