Nick Matzke wrote:
Hi all,

So I'm parsing an XML file returned from a database. However, the database entries have occasional non-ASCII characters, and this is crashing my parsers.

Is there some handy function out there that will schlep through a file like this, and do something like fix the characters that it can recognize, and delete those that it can't? Basically, like the BBEdit "convert to ASCII" menu option under "Text".

Lookup str.maketrans and str.translate, which can leave alone, replace, or delete each char.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to