Menu Close

How to URL decode UTF-8 in Python?

Sometimes, we want to URL decode UTF-8 in Python

In this article, we’ll look at how to URL decode UTF-8 in Python.

How to URL decode UTF-8 in Python?

To URL decode UTF-8 in Python, we can use the urllib.parse module’s unquote function.

For instance, we write

from urllib.parse import unquote

url = unquote(url)

to call unquote with the url we want to decode to decode the url URL string.

Then returned string is a Unicode string.

Conclusion

To URL decode UTF-8 in Python, we can use the urllib.parse module’s unquote function.

Posted in Python, Python Answers