From 9cf2855015a21b0d6c03d5e0fb9542b8bb6fb24b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 25 Jan 2002 14:30:30 +0000 Subject: [PATCH] handle 646 charset under Solaris as US-ASCII git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13801 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/intl.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 9c7a2e30b7..171ff158bd 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1260,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 @@ -1328,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 -- 2.45.2