Skip to content

Instantly share code, notes, and snippets.

@ValorLin
Created May 11, 2015 03:53
Show Gist options
  • Save ValorLin/8723a1525677b162eb20 to your computer and use it in GitHub Desktop.
Save ValorLin/8723a1525677b162eb20 to your computer and use it in GitHub Desktop.
to unicode and form unicode
var UnicodeConverter = {
toUnicode: function(str) {
return escape(str).toLocaleLowerCase().replace(/%u/gi, '\\u');
},
fromUnicode: function(str) {
return unescape(str.replace(/\\u/gi, '%u'));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment