[Tutor] string encoding
Rick Pasotto
rick at niof.net
Thu Jun 17 22:41:08 CEST 2010
I'm using BeautifulSoup to process a webpage. One of the fields has a
unicode character in it. (It's the 'registered trademark' symbol.) When
I try to write this string to another file I get this error:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-32: ordinal not in range(128)
In the interpreter the offending string portion shows as: 'Realtors\xc2\xae'.
How can I deal with this single string? The rest of the document works
fine.
--
"Freedom can't be kept for nothing. If you set a high value on liberty,
you must set a low value on everything else." -- Lucius Annaeus Seneca, 65
A.D.
Rick Pasotto rick at niof.net http://www.niof.net
More information about the Tutor
mailing list