Skip to content

Instantly share code, notes, and snippets.

@mediaupstream
Created April 4, 2012 17:18
Show Gist options
  • Select an option

  • Save mediaupstream/2303990 to your computer and use it in GitHub Desktop.

Select an option

Save mediaupstream/2303990 to your computer and use it in GitHub Desktop.
Convert a string to unicode numbers
//
// Usage:
//
// var test = encode_string('foobar');
// console.log( test ); // prints: 1021111119897114
//
var encode_string = function(str){
var result = '';
str.split('').forEach(function(c){ result += c.charCodeAt(c); });
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment