#include "wx/fontmap.h" // for CharsetToEncoding()
#endif
+#if defined(__WXMAC__)
+ #include "wx/mac/private.h" // includes mac headers
+#endif
+
// ----------------------------------------------------------------------------
// simple types
// ----------------------------------------------------------------------------
{
wxString encname;
-#ifdef __WIN32__
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
// FIXME: what is the error return value for GetACP()?
UINT codepage = ::GetACP();
encname.Printf(_T("windows-%u"), codepage);
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");
+ }
+ else
+#endif // __SOLARIS__
+ {
+ encname = wxConvLibc.cMB2WX(alang);
+ }
}
else
#endif // HAVE_LANGINFO_H
/* static */
wxFontEncoding wxLocale::GetSystemEncoding()
{
-#ifdef __WIN32__
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
UINT codepage = ::GetACP();
- // wxWindows only knows about CP1250-1257
+ // wxWindows only knows about CP1250-1257, 932, 936, 949, 950
if ( codepage >= 1250 && codepage <= 1257 )
{
return (wxFontEncoding)(wxFONTENCODING_CP1250 + codepage - 1250);
}
+
+ if ( codepage == 932 )
+ {
+ return wxFONTENCODING_CP932;
+ }
+
+ if ( codepage == 936 )
+ {
+ return wxFONTENCODING_CP936;
+ }
+
+ if ( codepage == 949 )
+ {
+ return wxFONTENCODING_CP949;
+ }
+
+ if ( codepage == 950 )
+ {
+ return wxFONTENCODING_CP950;
+ }
#elif defined(__UNIX_LIKE__) && wxUSE_FONTMAP
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
const wxChar *szDomain) const
{
if ( wxIsEmpty(szOrigString) )
- return szDomain;
+ return _T("");
const char *pszTrans = NULL;
#if wxUSE_UNICODE