Commit 35b06106 authored by Lennart Regebro's avatar Lennart Regebro

Only do the decoding if there is something to decode.

--HG--
branch : distribute
extra : rebase_source : 6510b361ce8885f536a3babfc66a7ebdfaa25b2d
parent fadd3a19
......@@ -199,7 +199,7 @@ class PackageIndex(Environment):
base = f.url # handle redirects
page = f.read()
if sys.version_info >= (3,):
if sys.version_info >= (3,) and not isinstance(f, urllib2.HTTPError):
charset = f.headers.get_param('charset') or 'latin-1'
page = page.decode(charset, "ignore")
f.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment