I wrote a custom xml parser and its locking up on special characters. So naturally I urlencoded them into my database.
I can't seem to find an equivalent to php's urldecode()
.
Are there any extentions for jquery or javascript that can accomplish this?
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.
Another function called the urldecode() function is another inbuilt function of PHP and is implemented for decoding the URL, encoded by the urlencode() function. Decoding is the approach of reversing the non-ASCII data back to its original form. This function will accept a single string as its parameter.
The decodeURIComponent() function decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine.
You could use the decodeURIComponent
function to convert the %xx into characters. However, to convert +
into spaces you need to replace them in an extra step.
function urldecode(url) { return decodeURIComponent(url.replace(/\+/g, ' ')); }
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