urlencode js code example
Example 1: urlencode javascript
var url = encodeURIComponent('url');
Example 2: js urlencode
encodeURI("test uri");
encodeURI("test uri");
encodeURI("test uri/with a slash");
encodeURIComponent("test uri/with a slash");
Example 3: encodeuricomponent js
var set1 = ";,/?:@&=+$";
var set2 = "-_.!~*'()";
var set3 = "#";
var set4 = "ABC abc 123";
console.log(encodeURI(set1));
console.log(encodeURI(set2));
console.log(encodeURI(set3));
console.log(encodeURI(set4));
console.log(encodeURIComponent(set1));
console.log(encodeURIComponent(set2));
console.log(encodeURIComponent(set3));
console.log(encodeURIComponent(set4));
Example 4: type script encode url
var encodeURI = encodeURIComponent("&")
Example 5: jq unencode string
# -r enable raw output
jq -r .[0].string FILE.json