encode url js code example
Example 1: urlencode javascript
var url = encodeURIComponent('url');
Example 2: js escape url parameter
var myUrl = "http://www.image.com/?username=unknown&password=unknown";
var encodedURL= "http://www.foobar.com/foo?imageurl=" + encodeURIComponent(myUrl);
Example 3: js urlencode
encodeURI("test uri");
encodeURI("test uri");
encodeURI("test uri/with a slash");
encodeURIComponent("test uri/with a slash");
Example 4: jq unencode string
# -r enable raw output
jq -r .[0].string FILE.json