- wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(enc);
- if (a[0] == enc)
- return; // no conversion needed, locale uses native encoding
+ wxFontEncoding targetEnc = wxFONTENCODING_SYSTEM;
+#ifdef __UNIX__
+ wxString langFull;
+ if (wxGetEnv(wxT("LC_ALL"), &langFull) ||
+ wxGetEnv(wxT("LC_CTYPE"), &langFull) ||
+ wxGetEnv(wxT("LANG"), &langFull))
+ {
+ wxString lcharset = langFull.AfterFirst(wxT('.')).BeforeFirst(wxT('@'));
+ if (!lcharset.IsEmpty())
+ targetEnc = wxTheFontMapper->CharsetToEncoding(lcharset, FALSE);
+ }
+#endif