Bug/kasm 3355 multibyte issue (#42)

Fix clipboard server to client decoding of multi-byte characters
This commit is contained in:
Anthony Merrill 2022-11-04 07:13:19 -04:00 committed by GitHub
parent 9f240fc7b1
commit a97fa93d84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 9 deletions

View File

@ -874,10 +874,7 @@ export default class RFB extends EventTargetMixin {
this.sentEventsCounter+=1;
let data = new Uint8Array(text.length);
for (let i = 0; i < text.length; i++) {
data[i] = text.charCodeAt(i);
}
let data = new TextEncoder().encode(text);
let h = hashUInt8Array(data);
// avoid resending the same data if larger than 64k
@ -2841,11 +2838,7 @@ export default class RFB extends EventTargetMixin {
mimes.push(mime);
if (mime == "text/plain") {
//textdata = new TextDecoder().decode(data);
for (let i = 0; i < data.length; i++) {
textdata+=String.fromCharCode(data[i]);
}
textdata = new TextDecoder().decode(data);
if ((textdata.length > 0) && "\0" === textdata.charAt(textdata.length - 1)) {
textdata = textdata.slice(0, -1);