Skip to content Skip to sidebar Skip to footer

Urllib.unquote Not Properly Decoding Url

I am able to do the following in the python shell: >>> import urllib >>> s='https://www.microsoft.com/de-at/store/movies/american-pie-pr%C3%A4sentiert-nackte-tats

Solution 1:

The following worked to fix the issue:

url = urllib.unquote(str(res.url)).decode('utf-8', 'ignore')

res.url was a unicode string, but didn't seem to work well with urllib.unquote. So the solution was to first convert it to a string (like how it was in the python interpreter) and then decode it into Unicode.


Post a Comment for "Urllib.unquote Not Properly Decoding Url"