https://bugs.kde.org/show_bug.cgi?id=527987

            Bug ID: 527987
           Summary: RDP: non-ASCII text from the local clipboard is
                    garbled in Windows applications that paste CF_TEXT
    Classification: Applications
           Product: krdc
      Version First 26.08.2
       Reported In:
          Platform: openSUSE
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: RDP
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

When I copy text with accented characters on the local machine and paste it
into an RDP session, some Windows applications receive it garbled. Slovak "á"
arrives as "á" and "ť" as "Å¥". Notepad on the same server gets the text
right, so it depends on which clipboard format the application asks for.

RdpClipboard::sendClipboard() stores the local text in the WinPR clipboard as
CF_TEXT, but encodes it with toUtf8(). CF_TEXT is ANSI text in the code page
given by CF_LOCALE, and WinPR announces CF_LOCALE as 0x0409 (en-US) next to it.
An application that reads CF_TEXT therefore decodes the UTF-8 bytes as
Windows-1252. Applications that read CF_UNICODETEXT are fine, because WinPR
converts the UTF-8 correctly when it synthesizes that format.

I checked the clipboard inside the session with a small script that lists the
formats and dumps their bytes. For the input "á ť" the server received:

  CF_TEXT         c3 a1 20 c5 a5 ...   (raw UTF-8)
  CF_UNICODETEXT  e1 00 20 00 65 01 ...   (correct)
  CF_LOCALE       09 04 00 00   (en-US)

Steps to reproduce:

1. connect to a Windows server with KRDC over RDP, clipboard sharing enabled
2. copy "á ť" in a local application
3. paste it in the session into an application that reads CF_TEXT

Expected result:

The application receives "á ť", or the closest equivalent in the code page of
the server, just as it does when the same text is copied on the server itself.

Actual result:

The application receives "á ť".

The code path is the same on master. I have a fix and will open a merge request
that refers to this report.

Environment:

openSUSE Tumbleweed, kernel 7.3.0, Wayland session
krdc 26.08.2, FreeRDP / WinPR 3.32.2
Plasma 6.8.1, Qt 6.12.0, KF6 6.31.0
Server: Windows Server 2022 (10.0.20348), ANSI code page 1252

I used an AI assistant while analysing this. I have checked everything above on
my own system and can explain it.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to