XML: minidom toxml() does not work for non English files! :-(

Martin v. Loewis martin at v.loewis.de
Tue May 7 01:21:47 EDT 2002


Trent Mick <trentm at ActiveState.com> writes:

>        Jaroslaw mentions that the problem goes away if he replaces
>        ActivePython 2.2.1's StringIO.py with the one from the PythonLabs
>        distro. That would be fine (a bug in ActivePython) except that
>        ActivePython has the more *recent* StringIO.py. So is Jaroslaw
>        misusing StringIO.py or is this StringIO.py checkin incorrect or
>        am I confused:

The most recent StringIO (1.22) has this:

class StringIO:
    def __init__(self, buf = ''):
        # Force self.buf to be a string or unicode
        if type(buf) is not types.UnicodeType:
            buf = str(buf)

IMO, this is "more correct" than just calling str every time.

Regards,
Martin



More information about the Python-list mailing list