Skip to content

Properly handle Unicode clipboard data on Windows.#5646

Open
nutzboi wants to merge 1 commit intosupertuxkart:masterfrom
nutzboi:clippygates
Open

Properly handle Unicode clipboard data on Windows.#5646
nutzboi wants to merge 1 commit intosupertuxkart:masterfrom
nutzboi:clippygates

Conversation

@nutzboi
Copy link
Contributor

@nutzboi nutzboi commented Feb 10, 2026

Bug

Currently, copying and pasting non-ASCII characters in STK on Windows is completely broken.
This is because

  1. STK ignores the SDL device when on Windows and OSX, and
  2. Unicode data in Windows clipboards are encoded in UTF-16 LE while STK attempts to read it as UTF-8.

Fix

This PR fixes it by prioritizing the usage of the SDL device for handling clipboards when available, and converting text data between UTF-8 and UTF-16 LE on Windows otherwise. This also eliminates the need for the overloading clipboard functions with wchar_t types.

Agreement

By creating a pull request in stk-code, you hereby agree to dual-license your contribution as
GNU General Public License version 3 or any later version and
Mozilla Public License version 2 or any later version.

This includes your previous contribution(s) under the same name of contributor.

Keep the above statement in the pull request comment for agreement.

@nutzboi nutzboi changed the title Properly handle Unicode clipboard data on Windows. Properly handle Unicode clipboard data. Feb 11, 2026
@nutzboi nutzboi marked this pull request as draft February 12, 2026 01:38
@nutzboi nutzboi marked this pull request as ready for review February 12, 2026 13:01
@nutzboi
Copy link
Contributor Author

nutzboi commented Feb 12, 2026

Final push; not touching this anymore (edit: oops, typo).
Also, #3751 should have already been fixed with SDL2 like Benau said. Can a linux Wayland user confirm?

@nutzboi nutzboi changed the title Properly handle Unicode clipboard data. Properly handle Unicode clipboard data on Windows. Feb 12, 2026
@nutzboi nutzboi marked this pull request as draft February 12, 2026 13:59
Prioritize using the SDL device to handle clipboard data, and properly convert text data between UTF-8 and UTF-16 LE on Windows, also eliminating the need for the overloading function with wchar_t type.
@nutzboi nutzboi marked this pull request as ready for review February 12, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant