Categories
Python Answers

How to URL decode UTF-8 in Python?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *