Hi, iam developing ap, which communicates with server over UDP. I use chrome sockets for this, but i have problem with correct conversion of string to arraybuffer and back. It somehow cant correctly convert characters with diacritics - for example ž gets converted as . Any ideas how to fix this little problem?
I use these two functions for encoding/decoding the string i want to send:
str2ab(str) {
var buf = new ArrayBuffer(str.length*2);
var bufView = new Uint8Array(buf);
for (var i = 0, strLen = str.length; i < strLen; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
ab2str(buf) {
return String.fromCharCode.apply(null, new Uint8Array(buf));
}
Or is it possible, that the problem occurs when i convert result from this function -base64 string to string with window.atob?
Any ideas how to fix this?