Fix CopyPasteSendText using character count instead of byte count - #802
Fix CopyPasteSendText using character count instead of byte count#802pwn2ooown wants to merge 1 commit into
Conversation
Glib::ustring::size() returns the number of UTF-8 characters, not bytes. This causes multi-byte text (e.g. CJK characters) to be truncated when passed to CPClipboard_SetItem, which expects a byte length. Use bytes() to get the correct byte count. Fixes vmware#800
🛑 Legal Compliance Check FailedHi @pwn2ooown, thank you for your contribution! To merge this Pull Request, you must sign our CLA. Note: Even if you signed off your commits locally (using 1. Read the Document: Click here to read the CLA ⏳ Processing Schedule: |
|
I have read the CLA Document and I hereby sign the CLA for this and all future contributions. |
Summary
CopyPasteUIX11::CopyPasteSendText()incopyPasteUIX11GTK4.cppusesGlib::ustring::size()as a byte length, butsize()returns the character count, not the byte count. This causes multi-byte text (e.g. CJK characters) to be truncated when passed toCPClipboard_SetItem, which expects a byte length.Fix: Replace
cpStr.size()withcpStr.bytes()to get the correct byte count.Fixes #800