X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9b7f3e3023c1885ec181169fe424b00fc0220270..9b69526274b023fa1460b29a92bea8bf82e4703f:/src/common/intl.cpp diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 83fac1f03b..171ff158bd 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -60,6 +60,10 @@ #include "wx/fontmap.h" // for CharsetToEncoding() #endif +#if defined(__WXMAC__) + #include "wx/mac/private.h" // includes mac headers +#endif + // ---------------------------------------------------------------------------- // simple types // ---------------------------------------------------------------------------- @@ -1256,7 +1260,19 @@ wxString wxLocale::GetSystemEncodingName() free(oldLocale); if (alang) { - encname = wxConvLibc.cMB2WX(alang); +#ifdef __SOLARIS__ + // nl_langinfo() under Solaris returns 646 by default which stands for + // ISO-646, i.e. 7 bit ASCII and we should recognize it to avoid + // warnings about unrecognized encoding on each program startup + if ( strcmp(alang, "646") == 0 ) + { + encname = _T("US-ASCII"); + } +#endif // __SOLARIS__ + else + { + encname = wxConvLibc.cMB2WX(alang); + } } else #endif // HAVE_LANGINFO_H @@ -1324,8 +1340,20 @@ wxFontEncoding wxLocale::GetSystemEncoding() wxString encname = GetSystemEncodingName(); if ( !encname.empty() ) { - return wxTheFontMapper-> + wxFontEncoding enc = wxTheFontMapper-> CharsetToEncoding(encname, FALSE /* not interactive */); + + // this should probably be considered as a bug in CharsetToEncoding(): + // it shouldn't return wxFONTENCODING_DEFAULT at all - but it does it + // for US-ASCII charset + // + // we, OTOH, definitely shouldn't return it as it doesn't make sense at + // all (which encoding is it?) + if ( enc != wxFONTENCODING_DEFAULT ) + { + return enc; + } + //else: return wxFONTENCODING_SYSTEM below } #endif // Win32/Unix @@ -1364,11 +1392,7 @@ const wxMB2WXbuf wxLocale::GetString(const wxChar *szOrigString, const wxChar *szDomain) const { if ( wxIsEmpty(szOrigString) ) -#if wxUSE_UNICODE - return szDomain ? szDomain : wxT(""); -#else // ANSI - return szDomain; -#endif + return _T(""); const char *pszTrans = NULL; #if wxUSE_UNICODE