On 2014-01-04 12:01, eryksun wrote:
On Sat, Jan 4, 2014 at 2:26 PM, Alex Kleider <aklei...@sonic.net> wrote:
.....

b'\xe1' is Latin-1. Look in the response headers:

url = 'http://api.hostip.info/get_html.php?ip=201.234.178.62&position=true'

    >>> response = urllib.request.urlopen(url)
    >>> response.headers.get_charsets()
    ['iso-8859-1']

    >>> encoding = response.headers.get_charsets()[0]
    >>> sp = response.read().decode(encoding).splitlines()
    >>> sp[1]
    'City: Bogotá'

Thank you very much.  Now things are more clear.
cheers,
alex
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to