Skip to content

Instantly share code, notes, and snippets.

@skylying
Created November 10, 2015 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skylying/ae16f2899be3ce3b16f0 to your computer and use it in GitHub Desktop.
Save skylying/ae16f2899be3ce3b16f0 to your computer and use it in GitHub Desktop.
HTML Injection work around
function encodePasswordAsHtmlEntities(value) {
var encodedStr = value.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
return '&#'+i.charCodeAt(0)+';';
});
return encodedStr.replace(/"/gim, '&quot;');;
//$('#output').html(encodedStr.replace(/&/gim, '&amp;'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment