How do I transform
www.bestbuy.com/site/Electronics\Audio\abcat0200000.c=3fid=3dabcat0200000
into its original format?
www.bestbuy.com/site/Electronics/Audio/abcat0200000.c?id=abcat0200000
Is there a urldecode
?
The urldecode() function is an inbuilt function in PHP which is used to decode url which is encoded by encoded() function. Syntax: string urldecode( $input ) Parameters: This function accepts single parameter $input which holds the url to be decoded. Return Value: This function returns the decoded string on success.
urlencode () is the function that can be used conveniently to encode a string before using in a query part of a URL. This is a convenient way for passing variables to the next page. urldecode() is the function that is used to decode the encoded string.
UrlDecode(String) Converts a string that has been encoded for transmission in a URL into a decoded string.
A better method is CGI.unescape
:
URI.unescape is deprecated
decoded_uri = CGI.unescape(encoded_uri)
Via decode
:
require 'uri' URI.decode(encoded_uri)
Ruby 2.7
and above:
require 'uri' URI.decode_www_form_component(encoded_uri)
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