Mask unsupported clipboard characters

Add a more explicit '?' for characters that the clipboard cannot handle,
instead of getting random junk.
This commit is contained in:
Pierre Ossman
2022-10-27 16:03:22 +02:00
parent 0410cbc190
commit 6b555f1f74
2 changed files with 16 additions and 2 deletions

View File

@@ -492,8 +492,14 @@ export default class RFB extends EventTargetMixin {
} else {
let data = new Uint8Array(text.length);
for (let i = 0; i < text.length; i++) {
// FIXME: text can have values outside of Latin1/Uint8
data[i] = text.charCodeAt(i);
let code = text.charCodeAt(i);
/* Only ISO 8859-1 is supported */
if (code > 0xff) {
code = 0x3f; // '?'
}
data[i] = code;
}
RFB.messages.clientCutText(this._sock, data);