This may be a stemming from my complete ignorance of unicode, but when I do this (Python 2.6):
s='\xc2\xa9 2008 \r\n' and I want the ascii version of it, ignoring any non-ascii chars, I thought I could do: s.encode('ascii','ignore') but it gives the error: In [20]:s.encode('ascii','ignore') ---------------------------------------------------------------------------- UnicodeDecodeError Traceback (most recent call last) /Users/bblais/python/doit100810a.py in <module>() ----> 1 2 3 4 5 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128) am I doing something stupid here? of course, as a workaround, I can do: ''.join([c for c in s if ord(c)<128]) but I thought the encode call should work. thanks, bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list