Created
September 21, 2014 06:51
-
-
Save stuartpb/64c0b6945c213eae74a0 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
function ucs2Bytes(s) { | |
var l = s.length; | |
var a = new Array(l*2); | |
for (var i = 0; i < l; ++i) { | |
a[i] = s.charCodeAt(i) && 0xFF; | |
a[i+1] = s.charCodeAt(i) >> 8; | |
} | |
return a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment