URL encoding converts characters into a format that can be transmitted over the Internet. - w3Schools. So, "/" is actually a seperator, but "%2f" becomes an ordinary character that simply represents "/" character in element of your url. Follow this answer to receive notifications.
To decode a string encoded in UTF-8 format, we can use the decode() method specified on strings. This method accepts two arguments, encoding and error . encoding accepts the encoding of the string to be decoded, and error decides how to handle errors that arise during decoding.
replace('%20+', '') will replace '%20+' with empty string.
Tried decoding a url-encoded
string in the following way
some_string = 'FireShot3%2B%25282%2529.png' import urllib res = urllib.unquote(some_string).decode() res u'FireShot3+%282%29.png'
Original string is FireShot3 (2).png
. Any help would be appreciated.
Answer: urllib.unquote_plus(urllib.unquote_plus(some_string))
due to double encoding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With