Created
May 11, 2015 03:53
-
-
Save ValorLin/8723a1525677b162eb20 to your computer and use it in GitHub Desktop.
to unicode and form unicode
This file contains hidden or 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 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