[XML-SIG] Follow-up on "minidom toxml() / Unicode problem"

Martin v. Loewis martin@v.loewis.de
17 Jul 2002 20:04:34 +0200


Dinu Gherman <gherman@darwin.in-berlin.de> writes:

> Can someone please try to summarize the recommended workaround, 
> if there is any? Or is minidom/string/whatever in 2.2.1 in 
> some sense "broken"? ;-)

The suggested work-around is

result = dom.toxml()
if isinstance(result, unicode):
  result = result.encode("utf-8")

In Python 2.3, you will be able to write

result = dom.toxml(encoding="utf-8")

Likewise in PyXML 0.8.

Regards,
Martin