UnicodeDecodeError having fetch web page

John Machin sjmachin at lexicon.net
Wed May 26 03:04:23 EDT 2010


Rob Williscroft <rtw <at> rtw.me.uk> writes:

> 
> Barry wrote in news:83dc485a-5a20-403b-99ee-c8c627bdbab3
> @m21g2000vbr.googlegroups.com in gmane.comp.python.general:
> 

> > UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1:
> > unexpected code byte
> 
> It may not be you, en.wiktionary.org is sending gzip 
> encoded content back,

It sure is; here's where the offending 0x8b comes from:

"""ID1 (IDentification 1)
   ID2 (IDentification 2)
            These have the fixed values ID1 = 31 (0x1f, \037), ID2 = 139
            (0x8b, \213), to identify the file as being in gzip format."""

(from http://www.faqs.org/rfcs/rfc1952.html)





More information about the Python-list mailing list