javascript html encode code example
Example 1: javascript html encode
function htmlEntities(s){
return s.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
return '' + i.charCodeAt(0) + ';';
});
}
Example 2: javascript html special characters
return mystring.replace(/&/g, "&").replace(/>/g, ">").replace(/
Example 3: jq unencode string
# -r enable raw output
jq -r .[0].string FILE.json