#include <locale.h>
#include <ctype.h>
#include <stdlib.h>
+#ifdef HAVE_LANGINFO_H
+ #include <langinfo.h>
+#endif
// wxWindows
#ifndef WX_PRECOMP
#if defined(HAVE_LANGINFO_H) && defined(CODESET)
// GNU libc provides current character set this way (this conforms
// to Unix98)
+ char *oldLocale = strdup(setlocale(LC_CTYPE, NULL));
+ setlocale(LC_CTYPE, "");
char *alang = nl_langinfo(CODESET);
+ setlocale(LC_CTYPE, oldLocale);
if (alang)
{
encname = wxConvLibc.cMB2WX(alang);
wxString encname = GetSystemEncodingName();
if ( !encname.empty() )
{
- return wxFontMapper::CharsetToEncoding(encname,
- FALSE /* not interactive */);
+ return wxTheFontMapper->
+ CharsetToEncoding(encname, FALSE /* not interactive */);
}
#endif // Win32/Unix