Index: intl.cpp =================================================================== RCS file: /pack/cvsroots/wxwindows/wxWindows/src/common/intl.cpp,v retrieving revision 1.96 diff -c -r1.96 intl.cpp *** intl.cpp 2003/06/13 10:16:19 1.96 --- intl.cpp 2003/07/07 00:30:25 *************** *** 141,146 **** --- 141,163 ---- #endif // __UNIX__ + #if wxUSE_UNICODE + + static wxWCharBuffer wxSetlocaleUtf(int c, const wxChar *lc) + { + wxWCharBuffer l=wxSetlocale(c, lc); + if (!l) + { + wxString buf(lc); + buf += wxT(".utf8"); + l=wxSetlocale(c, buf.c_str()); + } + return l; + } + #else + #define wxSetlocaleUtf(c, lc) wxSetlocale(c, lc) + #endif + // ---------------------------------------------------------------------------- // wxMsgCatalogFile corresponds to one disk-file message catalog. // *************** *** 615,621 **** wxCHECK_MSG( szLocale, FALSE, _T("no locale to set in wxLocale::Init()") ); } ! m_pszOldLocale = wxStrdup(wxSetlocale(LC_ALL, szLocale)); if ( m_pszOldLocale == NULL ) wxLogError(_("locale '%s' can not be set."), szLocale); --- 632,638 ---- wxCHECK_MSG( szLocale, FALSE, _T("no locale to set in wxLocale::Init()") ); } ! m_pszOldLocale = wxStrdup(wxSetlocaleUtf(LC_ALL, szLocale)); if ( m_pszOldLocale == NULL ) wxLogError(_("locale '%s' can not be set."), szLocale); *************** *** 679,690 **** else locale = info->CanonicalName; ! wxMB2WXbuf retloc = wxSetlocale(LC_ALL, locale); if ( !retloc ) { // Some C libraries don't like xx_YY form and require xx only ! retloc = wxSetlocale(LC_ALL, locale.Mid(0,2)); } if ( !retloc ) { --- 696,707 ---- else locale = info->CanonicalName; ! wxMB2WXbuf retloc = wxSetlocaleUtf(LC_ALL, locale); if ( !retloc ) { // Some C libraries don't like xx_YY form and require xx only ! retloc = wxSetlocaleUtf(LC_ALL, locale.Mid(0,2)); } if ( !retloc ) { *************** *** 702,714 **** else if (mid == wxT("nn")) locale = wxT("no_NY"); ! retloc = wxSetlocale(LC_ALL, locale); } if ( !retloc ) { // (This time, we changed locale in previous if-branch, so try again.) // Some C libraries don't like xx_YY form and require xx only ! retloc = wxSetlocale(LC_ALL, locale.Mid(0,2)); } if ( !retloc ) { --- 719,731 ---- else if (mid == wxT("nn")) locale = wxT("no_NY"); ! retloc = wxSetlocaleUtf(LC_ALL, locale); } if ( !retloc ) { // (This time, we changed locale in previous if-branch, so try again.) // Some C libraries don't like xx_YY form and require xx only ! retloc = wxSetlocaleUtf(LC_ALL, locale.Mid(0,2)); } if ( !retloc ) { *************** *** 764,770 **** } else { ! retloc = wxSetlocale(LC_ALL, locale); #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS if (codepage == 0 && (const wxChar*)retloc == NULL) { --- 781,787 ---- } else { ! retloc = wxSetlocaleUtf(LC_ALL, locale); #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS if (codepage == 0 && (const wxChar*)retloc == NULL) { *************** *** 1512,1518 **** // restore old locale wxSetLocale(m_pOldLocale); ! wxSetlocale(LC_ALL, m_pszOldLocale); free((wxChar *)m_pszOldLocale); // const_cast } --- 1529,1535 ---- // restore old locale wxSetLocale(m_pOldLocale); ! wxSetlocaleUtf(LC_ALL, m_pszOldLocale); free((wxChar *)m_pszOldLocale); // const_cast }