diff --git a/docs/changes.txt b/docs/changes.txt index 268da62bc7..65f2e34b99 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -272,6 +272,7 @@ wxMSW wxOSX: +- Fix crash on startup when using Farsi as system language (#25561). - Do not activate "Close" button on Cmd-C (nobugshere, #25346). diff --git a/src/osx/carbon/app.cpp b/src/osx/carbon/app.cpp index c5c7596a46..e5ce0db58b 100644 --- a/src/osx/carbon/app.cpp +++ b/src/osx/carbon/app.cpp @@ -306,7 +306,12 @@ bool wxApp::Initialize(int& argc, wxChar **argv) return false; #if wxUSE_INTL - wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding()); + // Check if we recognize the system encoding. Note that we must not call + // SetDefaultEncoding() if we don't, as indicated by wxFONTENCODING_DEFAULT + // being returned, as SetDefaultEncoding() would assert in this case. + const wxFontEncoding defaultEncoding = wxLocale::GetSystemEncoding(); + if ( defaultEncoding != wxFONTENCODING_DEFAULT ) + wxFont::SetDefaultEncoding(defaultEncoding); #endif // these might be the startup dirs, set them to the 'usual' dir containing the app bundle