]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed new charset detection code (langinfo.h not included in intl.cpp; langinfo.h...
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 2 Jun 2001 11:25:21 +0000 (11:25 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 2 Jun 2001 11:25:21 +0000 (11:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10412 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/intl.cpp
src/common/strconv.cpp

index aea952ed77ff8e7e2cf0f4ccde84c84c0e92aaf1..3b0a992d8906c017fe464b319cc9df0d31695b9f 100644 (file)
@@ -34,6 +34,9 @@
 #include <locale.h>
 #include <ctype.h>
 #include <stdlib.h>
+#ifdef HAVE_LANGINFO_H
+  #include <langinfo.h>
+#endif
 
 // wxWindows
 #ifndef WX_PRECOMP
@@ -955,7 +958,10 @@ wxString wxLocale::GetSystemEncodingName()
 #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);
index f60201d7d39987b7f4b992dce52fef8f5aadc0b4..b8982301a6a50b40fe6c0972870e63eba3bd20b1 100644 (file)
@@ -44,9 +44,6 @@
 #ifdef HAVE_ICONV_H
   #include <iconv.h>
 #endif
-#ifdef HAVE_LANGINFO_H
-  #include <langinfo.h>
-#endif
 
 #ifdef __WXMSW__
   #include <windows.h>