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
This commit is contained in:
Vadim Zeitlin
2002-01-25 14:30:30 +00:00
parent 307fd9567e
commit 9cf2855015

View File

@@ -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