okay, I have: # -*- coding: utf-8 -*-
in my python file.
the snippet:
opener = urllib2.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
opener.addheaders = [('Accept-Charset', 'utf-8')]
f =opener.open(url)
doc = f.read().decode('utf-8')
The server response is: (via f.info())
Content-Type: text/html; charset=UTF-8
but i get the error:
UnicodeDecodeError: 'utf8' codec can't decode byte[...]: invalid continuation byte
What's wrong here?