/gist:8dddb3196e59af60908f Secret
Created
April 14, 2013 15:54
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pip.backwardcompat import (WindowsError, BytesIO, | |
Queue, urlparse, | |
URLError, HTTPError, u, | |
product, url2pathname, ssl, | |
Empty as QueueEmpty, get_http_message_param) | |
from pip.download import urlopen, path_to_url2, url_to_path, geturl, Urllib2HeadRequest | |
url = 'http://www.dabeaz.com/ply/' | |
resp = urlopen(url) | |
headers = resp.info() | |
charset = get_http_message_param(headers, 'charset', 'latin-1') | |
contents = resp.read() | |
contents.decode('utf-8') | |
# UnicodeDecodeError: 'utf8' codec can't decode byte 0xf8 in position 10831: invalid start byte | |
contents.decode('latin-1') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment