RFR: 8281384: Random chars on paste from Windows clipboard [v4]
Michael Strauß
mstrauss at openjdk.org
Fri Feb 28 16:51:15 UTC 2025
On Thu, 27 Feb 2025 09:59:04 GMT, Oliver Schmidtmer <oschmidtmer at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/native-glass/win/GlassClipboard.cpp line 406:
>>
>>> 404: cdata = 0;
>>> 405: }
>>> 406: } else if(CF_TEXT == cf || CF_UNICODETEXT == cf){
>>
>> Instead of doing that, consider always requesting `CF_UNICODETEXT` from the clipboard. Windows will then convert both `CF_TEXT` and `CF_OEMTEXT` to unicode (see [Synthesized Clipboard Formats](https://learn.microsoft.com/en-us/windows/win32/dataxchg/clipboard-formats)).
>
> As the existing code was already pretty optimistic about 2 byte chars, is it possible that is already handled somewhere else?
> I'm not sure whether this is done explicitly somewhere or if CF_UNICODETEXT is just tried first.
Could be, but in any case, the way it's impemented right now doesn't seem to be right. We should only assume 2-byte characters if what's being pulled from the clipboard is actually `CF_UNICODETEXT`.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1724#discussion_r1975720976
More information about the openjfx-dev
mailing list