Correctly mask non-BMP clipboard characters
JavaScript strings use UTF-16 encoding under the hood, but we only want a single '?' per character we replace. So we need to be more careful which methods we use when iterating over the clipboard string.
This commit is contained in:
@@ -441,6 +441,14 @@ describe('Remote Frame Buffer Protocol Client', function () {
|
||||
new Uint8Array([97, 98, 99, 63]));
|
||||
});
|
||||
|
||||
it('should mask characters, not UTF-16 code points', function () {
|
||||
client.clipboardPasteFrom('😂');
|
||||
|
||||
expect(RFB.messages.clientCutText).to.have.been.calledOnce;
|
||||
expect(RFB.messages.clientCutText).to.have.been.calledWith(client._sock,
|
||||
new Uint8Array([63]));
|
||||
});
|
||||
|
||||
it('should send an notify if extended clipboard is supported by server', function () {
|
||||
// Send our capabilities
|
||||
let data = [3, 0, 0, 0];
|
||||
|
||||
Reference in New Issue
Block a user