Convert a URL-encoded string

Viewed 31

I have a string like "%d0%bf%d1%81%d0%b8%d1%85%d0%be%d0%bb%d0%be%d0%b3%d0%b8%d1%87%d0%b5%d1%81%d0%ba%d0%b0%d1%8f-%d0%bf%d0%be%d0%b4%d0%b4%d0%b5%d1%80%d0%b6%d0%ba%d0%b0"

Most probably this string contains an encoded Russian text. Please help to convert it using Python.

1 Answers
from urllib.parse import unquote
print(unquote("%d0%bf%d1%81%d0%b8%d1%85%d0%be%d0%bb%d0%be%d0%b3%d0%b8%d1%87%d0%b5%d1%81%d0%ba%d0%b0%d1%8f-%d0%bf%d0%be%d0%b4%d0%b4%d0%b5%d1%80%d0%b6%d0%ba%d0%b0", "utf-8"))

Argument "utf-8" is not needed as it is a default, added here fore demonstration.

Related