X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/34a34b020f1c8defacb299a0fa5c480fa65b8597..768a499594fd9c9fd0155d0513c7f5b785ce4439:/src/gtk1/app.cpp?ds=inline diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 6b9ddf198c..c9f166377f 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -606,6 +606,32 @@ bool wxApp::Initialize(int& argc, wxChar **argv) wxConvCurrent = (wxMBConv*) NULL; #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T +#ifdef __WXGTK20__ + // decide which conversion to use for the file names + + // (1) this variable exists for the sole purpose of specifying the encoding + // of the filenames for GTK+ programs, so use it if it is set + wxString encName(wxGetenv(_T("G_FILENAME_ENCODING"))); + encName.MakeUpper(); +#if wxUSE_INTL + if (encName.empty()) + { + // (2) if a non default locale is set, assume that the user wants his + // filenames in this locale too + encName = wxLocale::GetSystemEncodingName().Upper(); + // (3) finally use UTF-8 by default + if (encName.empty() || encName == _T("US-ASCII")) + encName = _T("UTF-8"); + wxSetEnv(_T("G_FILENAME_ENCODING"), encName); + } +#else + if (encName.empty()) + encName = _T("UTF-8"); +#endif // wxUSE_INTL + static wxConvBrokenFileNames fileconv(encName); + wxConvFileName = &fileconv; +#endif // __WXGTK20__ + #if wxUSE_UNICODE // gtk_init() wants UTF-8, not wchar_t, so convert int i;