X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c193821a999730fbf6a9bea83763f37daae68f1..5a98fd8de061e3dfcbad732e44ee33017493672f:/src/common/intl.cpp?ds=sidebyside diff --git a/src/common/intl.cpp b/src/common/intl.cpp index aef903c92b..b872663c75 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "intl.h" #endif @@ -513,6 +513,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, bool convertEncoding) cons } } #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T + (void)convertEncoding; // get rid of warnings about unused parameter } wxString wxMsgCatalogFile::GetCharset() const @@ -647,7 +648,9 @@ bool wxLocale::Init(const wxChar *szName, // TODO: how to find languageId // SetLocaleInfo(languageId, SORT_DEFAULT, localeName); #else - m_pszOldLocale = wxStrdup(wxSetlocale(LC_ALL, szLocale)); + m_pszOldLocale = wxSetlocale(LC_ALL, szLocale); + if ( m_pszOldLocale ) + m_pszOldLocale = wxStrdup(m_pszOldLocale); #endif if ( m_pszOldLocale == NULL ) @@ -683,11 +686,27 @@ bool wxLocale::Init(const wxChar *szName, static wxWCharBuffer wxSetlocaleTryUTF(int c, const wxChar *lc) { wxMB2WXbuf l = wxSetlocale(c, lc); - if ( lc && lc[0] != 0 && !l ) + if ( !l && lc && lc[0] != 0 ) { wxString buf(lc); - buf += wxT(".utf8"); - l = wxSetlocale(c, buf.c_str()); + wxString buf2; + buf2 = buf + wxT(".UTF-8"); + l = wxSetlocale(c, buf2.c_str()); + if ( !l ) + { + buf2 = buf + wxT(".utf-8"); + l = wxSetlocale(c, buf2.c_str()); + } + if ( !l ) + { + buf2 = buf + wxT(".UTF8"); + l = wxSetlocale(c, buf2.c_str()); + } + if ( !l ) + { + buf2 = buf + wxT(".utf8"); + l = wxSetlocale(c, buf2.c_str()); + } } return l; } @@ -1365,7 +1384,7 @@ wxString wxLocale::GetSystemEncodingName() // to Unix98) char *oldLocale = strdup(setlocale(LC_CTYPE, NULL)); setlocale(LC_CTYPE, ""); - char *alang = nl_langinfo(CODESET); + const char *alang = nl_langinfo(CODESET); setlocale(LC_CTYPE, oldLocale); free(oldLocale);