Skip to content

Instantly share code, notes, and snippets.

@FirstWhack
Created September 26, 2014 20:41
Show Gist options
  • Save FirstWhack/d051460119db91303a2a to your computer and use it in GitHub Desktop.
Save FirstWhack/d051460119db91303a2a to your computer and use it in GitHub Desktop.
encodeHTMLEnt()
function encodeHTMLEnt (str) {
var buf = [];
for (var i=str.length-1;i>=0;i--) {
buf.unshift(['&#', str[i].charCodeAt(), ';'].join(''));
}
return buf.join('');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment