When I try to scrape a wikipedia site with a special character in its URL, using urllib.request and Python, I get the following error UnicodeEncodeError: 'ascii' codec can't encode character '\xf8' in position 23: ordinal not in range(128)
The code:
# -*- coding: utf-8 -*-
import urllib.request as ur
url = "https://no.wikipedia.org/wiki/Jonas_Gahr_Støre"
r = ur.urlopen(url).read()
How can I use urllib.request with utf-8 encoding?