using ajax get method to pass a variable. where i use to escape the string with escape() function.
In php, I receive the value and insert into a database.
How do I unescape the string?
For example, for:
balaji's
I get
balaji%27s.
Usually, decodeURI or decodeURIComponent are preferred over unescape . Note: Do not use unescape to decode URIs, use decodeURI instead.
The escape() function is used to encode a string, making it safe for use in a URL. The unescape() function is used to decode an encoded string.
(programming) To reverse the escaping of a string quotations ▼
Converts any escaped characters in the input string.
You can use this function instead of urldecode()
function utf8_urldecode($str) {
return html_entity_decode(preg_replace("/%u([0-9a-f]{3,4})/i", "&#x\\1;", urldecode($str)), null, 'UTF-8');
}
You can try this:
htmlspecialchars(urldecode($str));
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