+ // 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 = encName.BeforeFirst(_T(','));
+ if (encName.CmpNoCase(_T("@locale")) == 0)
+ encName.clear();
+ 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");
+
+ // if wxUSE_INTL==0 it probably indicates that only "C" locale is supported
+ // by the program anyhow so prevent GTK+ from calling setlocale(LC_ALL, "")
+ // from gtk_init_check() as it does by default
+ gtk_disable_setlocale();
+
+#endif // wxUSE_INTL
+ static wxConvBrokenFileNames fileconv(encName);
+ wxConvFileName = &fileconv;
+
+
+ bool init_result;
+ int i;
+