Map wxDF_TEXT to text in UTF-8 encoding in wxOSX
Unix builds / Ubuntu 18.04 wxGTK 3 compatible 3.0 (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK UTF-8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxQt (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxX11 (push) Has been cancelled
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Has been cancelled
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxDFB (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 static with gcc 4.8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 2 (push) Has been cancelled
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Has been cancelled
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Has been cancelled
CMake builds / MSW/MSVC wxMSW (push) Has been cancelled
CMake builds / MSW/Clang wxMSW (push) Has been cancelled
CMake builds / macOS latest wxOSX Ninja (push) Has been cancelled
CMake builds / macOS 14 wxOSX Xcode (push) Has been cancelled
CMake builds / macOS 14 wxIOS (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 5.15 (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 6.10 (push) Has been cancelled
Mac builds / wxMac ARM ASAN not compatible (push) Has been cancelled
Mac builds / wxMac Universal C++14 (push) Has been cancelled
Mac builds / wxiOS Simulator on Silicon Mac (push) Has been cancelled
Mac builds / wxiOS (push) Has been cancelled
Mac builds / wxMac Intel C++17 (push) Has been cancelled
Mac Xcode builds / iOS Simulator static (push) Has been cancelled
Mac Xcode builds / macOS dynamic Release (push) Has been cancelled
Mac Xcode builds / iOS static Debug (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Release x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 Debug Win32 (push) Has been cancelled
MSW builds / wxMSW vs2022 Release arm64 (push) Has been cancelled
MSW builds / wxMSW vs2026 DLL Release x64 (push) Has been cancelled
MSW cross-builds / wxMSW 64 bits not compatible (push) Has been cancelled
MSW cross-builds / wxMSW/Univ (push) Has been cancelled
MSW cross-builds / wxMSW 32 bits (push) Has been cancelled
Code Checks / Check Spelling (push) Has been cancelled
Code Checks / Check Whitespace (push) Has been cancelled
Code Checks / Check Mixed EOL (push) Has been cancelled
Code Checks / Check C++ Style (push) Has been cancelled
Code Checks / Check All Headers In allheaders.h (push) Has been cancelled
Update Documentation / Update Online Documentation (push) Has been cancelled

Don't use legacy encoding for it, this was unexpected and resulted in
e.g. wxClipboard::IsSupported(wxDF_TEXT) returning false when there was
text on the clipboard and IsSupported(wxDF_UNICODETEXT) returned true.

On current systems text and Unicode text are the same thing, so make
behaviour of wxDF_TEXT consistent with wxDF_UNICODETEXT.

See #26552.

Closes #26565.
This commit is contained in:
Stefan Csomor
2026-06-17 02:14:01 +02:00
committed by Vadim Zeitlin
parent 32d9ea2b08
commit 7148a49c6d
4 changed files with 12 additions and 5 deletions
+5
View File
@@ -140,6 +140,11 @@ Changes in behaviour not resulting in compilation errors
already didn't do it in wxMSW. Call Show() explicitly before Raise() if
necessary.
- wxDF_TEXT on macOS now corresponds to the text in UTF-8 encoding instead of
previously used MacRoman. No changes are necessary for the programs using
wxTextDataObject, but for the code working with the raw bytes in this format
you may need to change it to use wxConvUTF8 instead of wxConvLocal.
Changes in behaviour which may result in build errors
-----------------------------------------------------
+2 -2
View File
@@ -751,8 +751,8 @@ public:
/**
Returns 2 under wxMac and wxGTK, where text data coming from the
clipboard may be provided as ANSI (@c wxDF_TEXT) or as Unicode text
(@c wxDF_UNICODETEXT).
clipboard may be provided as (@c wxDF_TEXT), in ANSI (wxGTK) or UTF8 (wxMac),
or as Unicode text (@c wxDF_UNICODETEXT).
Returns 1 under other platforms (e.g. wxMSW).
*/
+4
View File
@@ -345,7 +345,11 @@ inline wxMBConv& GetConv(const wxDataFormat& format)
static wxMBConvUTF16 s_UTF16Converter;
return format == wxDF_UNICODETEXT ? static_cast<wxMBConv&>(s_UTF16Converter)
#ifdef __WXOSX__
: static_cast<wxMBConv&>(wxConvUTF8);
#else
: static_cast<wxMBConv&>(wxConvLocal);
#endif
}
} // anonymous namespace
+1 -3
View File
@@ -33,8 +33,6 @@
#include <memory>
static CFStringRef kUTTypeTraditionalMacText = CFSTR("com.apple.traditional-mac-plain-text");
static wxString privateUTIPrefix = "org.wxwidgets.private.";
// ----------------------------------------------------------------------------
@@ -94,7 +92,7 @@ wxDataFormat::NativeFormat wxDataFormat::GetFormatForType(wxDataFormatId type)
switch (type)
{
case wxDF_TEXT:
f = kUTTypeTraditionalMacText;
f = kUTTypeUTF8PlainText;
break;
case wxDF_UNICODETEXT: