xml.dom.minidom.parse(fname).save() still complains about UnicodeError...

Martin v. Loewis martin at v.loewis.de
Thu Nov 14 02:22:56 EST 2002


juha.o.ylitalo at kolumbus.fi (juha.o.ylitalo at kolumbus.fi) writes:

> >>> print d.toxml()
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> UnicodeError: ASCII encoding error: ordinal not in range(128)

Here, .toxml() returns a unicode object. It is the attempt to print
this Unicode object that fails.

Try

print d.toxml().encode("utf-8")

Regards,
Martin



More information about the Python-list mailing list