Hallöchen! Stefan Behnel writes:
> Torsten Bronger wrote: > >> Stefan Behnel writes: >> >>> Torsten Bronger wrote: >>> >>>> [...] >>>> >>>> My problem is that if there is only ASCII, these methods return >>>> ordinary strings instead of unicode. So sometimes I get str, >>>> sometimes I get unicode. Can one change this globally so that >>>> they only return unicode? > > [...] > > I just looked at the code. It seems that you can use your own > XMLTreeBuilder subclass and overwrite the "._fixtext()" method > like this: > > def _fixtext(self, text): > return text Great. Thus, the following monkeypatch seems to do the trick: from xml.etree import ElementTree # FixMe: Must go away with Python 3 ElementTree.XMLTreeBuilder._fixtext = lambda self, text: text Thank you! Tschö, Torsten. -- Torsten Bronger, aquisgrana, europa vetus Jabber ID: torsten.bron...@jabber.rwth-aachen.de -- http://mail.python.org/mailman/listinfo/python-list