Problem with UnicodeError and xml.dom.minidom

Paul Prescod paulp at
Mon Jun 11 19:39:19 EDT 2001

Gustaf Liljegren wrote:
> Hope this is enough info for someone to solve it. Otherwise, I'd gladly
> share the complete code if you need. But it may be too much for a
> newsgroup.

The easiest thing is to do the comparison as 8-bit strings rather than
Unicode strings:

if string.find(m.get('from'), e.encode("Latin-1")): 

or both as Unicode strings:

if string.find(unicode(m.get('from'), "Latin-1"), e):

Some of us have fought a losing war to make Python do that for you
automatically but the opposition is fierce, well organized and well
funded. ;)

Take a recipe. Leave a recipe.  
Python Cookbook!

More information about the Python-list mailing list