Generalize wxOSX locale workaround to all ports under Darwin

As all ports use the same CRT, it makes more sense to check for Darwin,
rather than wxOSX, in wxEnsureLocaleIsCompatibleWithCRT(), as other
ports such as wxGTK would also be affected by this problem if they were
to be used under macOS.
This commit is contained in:
Vadim Zeitlin 2023-04-24 22:51:17 +02:00
parent fcde4ac7c6
commit a68db909f0

View file

@ -51,7 +51,7 @@ private:
// under the other platforms currently).
inline void wxEnsureLocaleIsCompatibleWithCRT()
{
#if defined(__WXOSX__)
#if defined(__DARWIN__)
// In OS X and iOS, wchar_t CRT functions convert to char* and fail under
// some locales. The safest fix is to set LC_CTYPE to UTF-8 to ensure that
// they can handle any input.
@ -61,7 +61,7 @@ inline void wxEnsureLocaleIsCompatibleWithCRT()
//
// See https://stackoverflow.com/questions/11713745/why-does-the-printf-family-of-functions-care-about-locale
setlocale(LC_CTYPE, "UTF-8");
#endif // defined(__WXOSX__)
#endif // defined(__DARWIN__)
}
#endif // _WX_PRIVATE_LOCALESET_H_