using python 2.5.2 and linux debian i'm trying to get the content from a spanish url that contains a spanish char ('í'):
import urllib url = u'http://mydomain.es/índice.html' content = urllib.urlopen(url).read()
I'm getting this error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 8: ordinal not in range(128)
I've tried using before passing the url to urllib this:
url = urllib.quote(url)
and this:
url = url.encode('UTF-8')
but it doesn't work
can you tell me what I am doing wrong ?
thanks !