Created
January 14, 2016 09:25
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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