Bug/kasm 3355 multibyte issue (#42)
Fix clipboard server to client decoding of multi-byte characters
This commit is contained in:
parent
9f240fc7b1
commit
a97fa93d84
11
core/rfb.js
11
core/rfb.js
|
@ -874,10 +874,7 @@ export default class RFB extends EventTargetMixin {
|
||||||
|
|
||||||
this.sentEventsCounter+=1;
|
this.sentEventsCounter+=1;
|
||||||
|
|
||||||
let data = new Uint8Array(text.length);
|
let data = new TextEncoder().encode(text);
|
||||||
for (let i = 0; i < text.length; i++) {
|
|
||||||
data[i] = text.charCodeAt(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
let h = hashUInt8Array(data);
|
let h = hashUInt8Array(data);
|
||||||
// avoid resending the same data if larger than 64k
|
// avoid resending the same data if larger than 64k
|
||||||
|
@ -2841,11 +2838,7 @@ export default class RFB extends EventTargetMixin {
|
||||||
mimes.push(mime);
|
mimes.push(mime);
|
||||||
|
|
||||||
if (mime == "text/plain") {
|
if (mime == "text/plain") {
|
||||||
|
textdata = new TextDecoder().decode(data);
|
||||||
//textdata = new TextDecoder().decode(data);
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
|
||||||
textdata+=String.fromCharCode(data[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((textdata.length > 0) && "\0" === textdata.charAt(textdata.length - 1)) {
|
if ((textdata.length > 0) && "\0" === textdata.charAt(textdata.length - 1)) {
|
||||||
textdata = textdata.slice(0, -1);
|
textdata = textdata.slice(0, -1);
|
||||||
|
|
Loading…
Reference in New Issue