[XML-SIG] Q: minidom and iso-8859-1
J.R. van Ossenbruggen
Jacco.van.Ossenbruggen@cwi.nl
Tue, 12 Sep 2000 10:11:45 +0200
On Tue, Sep 12 2000 "Martin v. Loewis" wrote:
> > BTW, I expected that converting to UTF-8 would also print the right
> > result, but it didn't. What am I missing here?
>
> Hard to say. Converting to UTF-8 will print the right result, which
> result did you get?
# Input file test.xml:
#
# <?xml version="1.0" encoding='iso-8859-1'?>
# <test>Grønbæck</test>"""
import sys
import xml.dom.minidom
p=xml.dom.minidom.parse('test.xml')
print p.documentElement.childNodes[0].nodeValue.encode('UTF-8')
# wrong; prints: Grønbæck
print p.documentElement.childNodes[0].nodeValue.encode('iso-8859-1')
# right; prints: Grønbæck
-- Jacco