When copying text from the client host and pasting to the remote desktop, an extra null character is added. This may be obfuscated by certain applications or clipboard software. I was able to observe it only when pasting into emacs.
Reproduce:
Possible Cause:
In AnsiStringStorage.cpp: void AnsiStringStorage::fromStringStorage, the following code is used to convert string formats.
// WideCharToMultiByte returns result length including terminating null character
int symbolCount = WideCharToMultiByte(CP_ACP, 0, src->getString(), -1,
NULL, 0, NULL, NULL) + 1;
Both the comment in the code and the WideCharToMultiByte function documentation agree: the return result length includes the terminating null character. Adding an additional +1 to that length may be extraneous. Removing the extra +1 appears to resolve the issue.
This seems to affect most java applications too, If pasted into jave it shows as if there is no extra character but there is one when selecting or moving between characters with arrow keys.
Last edit: sapentidiot 2019-10-21