Trouble fixing a broken ASCII string - replace mode in codec not working.

2007-02-06 Thread John Nagle
I'm trying to clean up a bad ASCII string, one read from a web page that is supposedly in the ASCII character set but has some characters above 127. And I get this: File D:\projects\sitetruth\InfoSitePage.py, line 285, in httpfetch sitetext = sitetext.encode('ascii','replace') #

Re: Trouble fixing a broken ASCII string - replace mode in codec not working.

2007-02-06 Thread Robert Kern
John Nagle wrote: I'm trying to clean up a bad ASCII string, one read from a web page that is supposedly in the ASCII character set but has some characters above 127. And I get this: File D:\projects\sitetruth\InfoSitePage.py, line 285, in httpfetch sitetext =

Re: Trouble fixing a broken ASCII string - replace mode in codec not working.

2007-02-06 Thread Neil Cerutti
On 2007-02-06, Robert Kern [EMAIL PROTECTED] wrote: John Nagle wrote: File D:\projects\sitetruth\InfoSitePage.py, line 285, in httpfetch sitetext = sitetext.encode('ascii','replace') # force to clean ASCII UnicodeDecodeError: 'ascii' codec can't decode byte 0x92 in position 29151: