sax barfs on unicode filenames: workaround

Edward K. Ream edreamleo at charter.net
Wed Oct 4 17:56:00 CEST 2006


Happily, the workaround is easy.  Replace theFile with:

# Use cStringIo to avoid a crash in sax when inputFileName has unicode 
characters.
s = theFile.read()
theFile = cStringIO.StringIO(s)

My first attempt at a workaround was to use:

s = theFile.read()
parser.parseString(s)

but the expat parser does not support parseString...

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