minidom and unicode errors
Fredrik Lundh
fredrik at pythonware.com
Tue Mar 7 01:39:52 EST 2006
Abhimanyu Seth wrote:
> > I have the following line in my xml file:
> > <target>Exception beim Löschen des Audit-Moduls aufgetreten. Exception
> Stack
> > lautet: %1.</target>
> > ExpatError: not well-formed (invalid token): line 8, column 27
> I've specified utf-8 in the xml header
> <?xml version="1.0" encoding="utf-8"?>
are you sure you're using utf-8 in the XML file? the ö you pasted into
your mail is an iso-8859-1 code, not an utf-8 code.
> Anyway,
> >> f = codecs.open ("c:/test.txt", "r", "latin-1")
> >> dom = minidom.parseString (codecs.encode (f.read(), "utf-8"))
> works.
which means that you've labelled the file as utf-8, but that it actually
contains iso-8859-1. fixing the file should fix this.
</F>
More information about the Python-list
mailing list