Created
February 22, 2012 17:33
-
-
Save eikes/1886209 to your computer and use it in GitHub Desktop.
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
String.prototype.toUnicode = function (){ | |
function pad(t) { | |
return t.length == 4 ? t : pad("0" + t); | |
} | |
var r=""; | |
for (var i = 0; i < this.length; i++) { | |
r += "\\u" + pad(this.charCodeAt(i).toString(16)); | |
} | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment