Skip to content

Instantly share code, notes, and snippets.

@JavaScript-Packer
Created January 14, 2016 09:25
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 JavaScript-Packer/4fcbb3d5bfd8f3782940 to your computer and use it in GitHub Desktop.
Save JavaScript-Packer/4fcbb3d5bfd8f3782940 to your computer and use it in GitHub Desktop.
UTF-8 to character code points array, bot encode and decode functions
var toCharCode = function(x) {
var o, e = x.split(""), t = [];
for (o in e) t.push(e[o].charCodeAt(0));
return t;
};
var unCharCode = function(x) {
return this["eval"]("String.fromCharCode(" + x + ")");
};
console.log(toCharCode("www.WHAK.ca").join(","));
console.log(unCharCode("119,119,119,46,87,72,65,75,46,99,111,109"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment