[XML-SIG] Q: minidom and iso-8859-1

J.R. van Ossenbruggen Jacco.van.Ossenbruggen@cwi.nl
Mon, 11 Sep 2000 13:25:01 +0200

I used minidom/pyexpat/python 2.0b1 to parse an xml file that starts

     <?xml version="1.0" encoding='iso-8859-1'?>

When I try to print the nodeValues that contain non-ascii chars, I get:

     UnicodeError: ASCII encoding error: ordinal not in range(128)

Explicitly converting the value using value.encode('iso-8859-1')
before printing seems to do the trick.  But how can I, in general,
find out what the original encoding of the XML file was?  E.g. what if
I want to use the same program for XML files that use different

BTW, I expected that converting to UTF-8 would also print the right
result, but it didn't.  What am I missing here?


-- Jacco