fix chinese garbled code

change clipboardPasteFrom unicode encode
This commit is contained in:
gongym 2020-07-20 11:32:19 +08:00 committed by GitHub
parent 9142f8f0f7
commit ebcb7cc67b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -489,10 +489,12 @@ export default class RFB extends EventTargetMixin {
this._clipboardText = text;
RFB.messages.extendedClipboardNotify(this._sock, [extendedClipboardFormatText]);
} else {
let data = new Uint8Array(text.length);
let data = [];
for (let i = 0; i < text.length; i++) {
// FIXME: text can have values outside of Latin1/Uint8
data[i] = text.charCodeAt(i);
idx = text.charCodeAt(i);
data.push(idx & 0xff);
data.push(idx >> 8);
}
RFB.messages.clientCutText(this._sock, data);