In that case, I think you should just drop the String.fromCharCode(). It'll convert your number into a character, and since you want numbers you just have to leave them out, no?
But if you want the high-order byte first, you'll need to swap the two around, because at the moment the low-order is first.
code:
function SetDataPatch(sUnicodeString) {
var newstring = "";
for (var i = 0; i < sUnicodeString.length; i++) {
var charCode = sUnicodeString.charCodeAt( i );
newstring += charCode >>> 8; //High-order
newstring += charCode & 0xFF; //Low-order
}
return newstring;
}
But this functions will only join the decimal numbers together... Do you want spaces between the numbers? Do you want the numbers to be hexadecimal? You really should give us a clear explanation of what your function has to do.