Skip to content

Instantly share code, notes, and snippets.

@romeoh
Created February 21, 2013 02:02
Show Gist options
  • Save romeoh/5001342 to your computer and use it in GitHub Desktop.
Save romeoh/5001342 to your computer and use it in GitHub Desktop.
toHex
function onInitPage(){
console.log(toHex('김'))
console.log(toHex('K'))
}
function toHex(str){
var hex = '';
for (var i=0; i<str.length; i++){
hex += str.charCodeAt(i).toString(16);
}
return hex;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment