Jose' Matos wrote: >> Any gurus got a python solution? > > That was to be expected: > http://docs.python.org/lib/string-methods.html#l2h-180 > > Notice the second argument for encoding, by default it is 'strict', > and it bails out if any error occurs. > > You have the explanation for the different values of the second > argument here: > http://docs.python.org/lib/module-codecs.html > > So you want probably 'ignore'. (?)
Many thanks, José. This was exactly what I was looking for. In the end, I decided to be pragmatic: txt_credits_data = unicode(as_txt_credits(contributers)) \ .encode("latin1", "xmlcharrefreplace") # This is a fudge to give a 'reasonable' spelling of Matej's name. txt_credits_data = txt_credits_data.replace('ě', 'e') txt_credits = open(argv[1], "w") txt_credits.write(txt_credits_data) -- Angus