RFR: 8281384: Random chars on paste from Windows clipboard [v4]
Kevin Rushforth
kcr at openjdk.org
Tue Mar 25 17:31:18 UTC 2025
On Tue, 25 Mar 2025 09:53:10 GMT, Lukasz Kostyra <lkostyra at openjdk.org> wrote:
>> As @mstr2 said, I think the data is always converted to CF_UNICODETEXT. If it wasn't there should have been more visible problems, as the current code always assumes wide chars.
>>
>> So I just need to know how much we should change within this ticket: Just removing CF_TEXT from here, or also removing flavors from create_mime_stuff().
>
> I think the point is to explicitly request `CF_UNICODETEXT` and, if Clipboard has `CF_TEXT` or `CF_OEMTEXT` inside, it will automatically convert it to Unicode on output. This way we ensure we always get 2-byte Unicode text independently of Clipboard contents. So I would say to change the flavors in `create_mime_stuff()` as well.
That makes sense to me, too. I was originally thinking that removing the `CF_TEXT == cf ||` in this `if` statement would be sufficient, but it's certainly safer, and seems more correct, to also ensure that we request `CF_UNICODETEXT`, given that here and in the calling Java code, we assume 2-byte Unicode.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1724#discussion_r2012594032
More information about the openjfx-dev
mailing list