Re: BeautifulSoup error
- From: Slawomir Nowaczyk <slawomir.nowaczyk.847@xxxxxxxxxxxxx>
- Date: Fri, 16 Jun 2006 10:14:51 +0200
On Fri, 16 Jun 2006 15:20:48 +1000
Ben Finney <bignose+hates-spam@xxxxxxxxxxxxxxx> wrote:
#> > >>> soup = BeautifulSoup()
#> > >>> soup.feed(port)
#> > Traceback (most recent call last):
#> > File "<stdin>", line 1, in ?
#> > File "/usr/lib/python2.3/sgmllib.py", line 94, in feed
#> > self.rawdata = self.rawdata + data
#> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xb8 in position 565: ordinal not in range(128)
#> > >>>
#>
#> Uses the default Python text encoding, 'ascii', when it needs to
#> decode the data in 'port' to Unicode. Some of the data in that
#> object makes no sense in the 'ascii' encoding, so it barfs.
In other words, this works for me:
soup.feed( unicode(port,"iso-8859-1") )
--
Best wishes,
Slawomir Nowaczyk
( Slawomir.Nowaczyk@xxxxxxxxx )
^[:wq! Crap! Thought I was in vi.
.
- Prev by Date: Re: a good programming text editor (not IDE)
- Next by Date: Re: list of polynomial functions
- Previous by thread: Re: BeautifulSoup error
- Next by thread: Re: BeautifulSoup error
- Index(es):
Relevant Pages
|
|