string.replace non-ascii characters
Samuel Karl Peterson
skpeterson at nospam.please.ucdavis.edu
Sun Feb 11 23:55:17 EST 2007
Greetings Pythonistas. I have recently discovered a strange anomoly
with string.replace. It seemingly, randomly does not deal with
characters of ordinal value > 127. I ran into this problem while
downloading auction web pages from ebay and trying to replace the
"\xa0" (dec 160, nbsp char in iso-8859-1) in the string I got from
urllib2. Yet today, all is fine, no problems whatsoever. Sadly, I
did not save the exact error message, but I believe it was a
ValueError thrown on string.replace and the message was something to
the effect "character value not within range(128).
Some googling seemed to indicate other people have reported similar
troubles:
http://mail.python.org/pipermail/python-list/2006-July/391617.html
Anyone have any enlightening advice for me?
--
Sam Peterson
skpeterson At nospam ucdavis.edu
"if programmers were paid to remove code instead of adding it,
software would be much better" -- unknown
More information about the Python-list
mailing list