diff --git a/docs/changes.txt b/docs/changes.txt index 5a557f761d..5f5fafc2ab 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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 ----------------------------------------------------- diff --git a/interface/wx/dataobj.h b/interface/wx/dataobj.h index 0fda3c1124..7239b72509 100644 --- a/interface/wx/dataobj.h +++ b/interface/wx/dataobj.h @@ -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). */ diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp index 9faf4e404c..be4d6459d3 100644 --- a/src/common/dobjcmn.cpp +++ b/src/common/dobjcmn.cpp @@ -345,7 +345,11 @@ inline wxMBConv& GetConv(const wxDataFormat& format) static wxMBConvUTF16 s_UTF16Converter; return format == wxDF_UNICODETEXT ? static_cast(s_UTF16Converter) +#ifdef __WXOSX__ + : static_cast(wxConvUTF8); +#else : static_cast(wxConvLocal); +#endif } } // anonymous namespace diff --git a/src/osx/carbon/dataobj.cpp b/src/osx/carbon/dataobj.cpp index 423da3784a..0c7dd6face 100644 --- a/src/osx/carbon/dataobj.cpp +++ b/src/osx/carbon/dataobj.cpp @@ -33,8 +33,6 @@ #include -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: