small inconsistency in ElementTree (1.2.6)

Damjan gdamjan at
Sat Dec 10 17:17:48 CET 2005

>>> ascii strings and unicode strings are perfectly interchangable, with
>>> some minor exceptions.
>> It's not only translate, it's decode too...
> why would you use decode on the strings you get back from ET ?

Long story... some time ago when computers wouldn't support charsets
invented so called "cyrillic fonts" - ie a font that has cyrillic
mapped on the latin posstions. Since our cyrillic alphabet has 31
characters, some characters in said fonts were mapped to { or ~ etc..
course this ,,sollution" is awful but it was the only one at the

So I'm making a python script that takes an OpenDocument file and
it to UTF-8...

ps. I use translate now, but I was making a general note that unicode
string objects are not 100% interchangeable. translate, encode, decode
especially problematic.

anyway, I wrap the output of ET in unicode() now... I don't see
another, better, sollution.

More information about the Python-list mailing list