Sax2 encoding
Frank Buss
fb at frank-buss.de
Fri Aug 30 07:40:11 EDT 2002
"Juan M. Casillas" <juanm.casillas at eresmas.com> wrote:
> I have an xml document that only begins with
>
> <?xml version="1.0"?>
> [...]
>
>
> That is, without no info about the encoding.
Never don't use no double negation! :-)
Perhaps you should change the XML files (or saying the author to change
it) to add the encoding, because then there are no problems.
> import sys
> from xml.dom.ext.reader import Sax2
I don't have this, do you use PyXML? With my out-of-the-box Python 2.2.1
I can do the following:
import sys
from xml.dom.minidom import parseString
doc = parseString(unicode(open(sys.argv[1]).read(),'iso-8859-1'))
--
Frank Buß, fb at frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
More information about the Python-list
mailing list