I want to URL encode this:
SELECT name FROM user WHERE uid = me()
Do I have to download a module for this? I already have the request module.
URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits. URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+) sign or with %20.
Decoding in Javascript can be achieved using decodeURI function. It takes encodeURIComponent(url) string so it can decode these characters. 2. unescape() function: This function takes a string as a single parameter and uses it to decode that string encoded by the escape() function.
JavaScript encodeURI() The encodeURI() method encodes a URI.
You can use JavaScript's encodeURIComponent
:
encodeURIComponent('select * from table where i()')
giving
'select%20*%20from%20table%20where%20i()'
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