diff -Naur mahogany-0.67.cvs/include/gui/wxMApp.h mahogany-0.67.utf8warn/include/gui/wxMApp.h --- mahogany-0.67.cvs/include/gui/wxMApp.h 2006-09-04 20:27:35.000000000 +0200 +++ mahogany-0.67.utf8warn/include/gui/wxMApp.h 2006-09-04 20:22:24.000000000 +0200 @@ -81,6 +81,8 @@ virtual bool CanClose() const; virtual void OnClose(); + wxFontEncoding GetSystemEncoding_Workaround(); + // wxWin calls these functions to start/run/stop the application virtual bool OnInit(); virtual int OnRun(); diff -Naur mahogany-0.67.cvs/src/gui/wxMApp.cpp mahogany-0.67.utf8warn/src/gui/wxMApp.cpp --- mahogany-0.67.cvs/src/gui/wxMApp.cpp 2006-09-04 20:27:41.000000000 +0200 +++ mahogany-0.67.utf8warn/src/gui/wxMApp.cpp 2006-09-04 20:22:36.000000000 +0200 @@ -909,6 +909,39 @@ #endif // 0 } +wxFontEncoding wxMApp::GetSystemEncoding_Workaround() +{ + const wxString encname = wxLocale::GetSystemEncodingName(); + if ( !encname.empty() ) + { + wxFontEncoding enc = wxFontMapperBase::GetEncodingFromName(encname); + + // on some modern Linux systems (RedHat 8) the default system locale + // is UTF8 -- but it isn't supported by wxGTK1 in ANSI build at all so + // don't even try to use it in this case +#if !wxUSE_UNICODE && \ + ((defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__WXMOTIF__)) + if ( enc == wxFONTENCODING_UTF8 ) + { + // the most similar supported encoding... + enc = wxFONTENCODING_ISO8859_1; + } +#endif // !wxUSE_UNICODE + + // GetEncodingFromName() returns wxFONTENCODING_DEFAULT for C locale + // (a.k.a. US-ASCII) which is arguably a bug but keep it like this for + // backwards compatibility and just take care to not return + // wxFONTENCODING_DEFAULT from here as this surely doesn't make sense + if ( enc != wxFONTENCODING_MAX && enc != wxFONTENCODING_DEFAULT ) + { + return enc; + } + //else: return wxFONTENCODING_SYSTEM below + } + + return wxFONTENCODING_SYSTEM; +} + // app initilization bool wxMApp::OnInit() @@ -1102,12 +1135,10 @@ } #endif // USE_I18N - // wxLocale::GetSystemEncoding() is broken in wx <= 2.6.3, it returns - // ISO-8859-1 for UTF-8 locale -#if defined(__WXGTK20__) && wxCHECK_VERSION(2, 6, 4) +#ifdef __WXGTK20__ // we need UTF-8 support to be able to work with messages in different // encodings - if ( wxLocale::GetSystemEncoding() != wxFONTENCODING_UTF8 ) + if ( GetSystemEncoding_Workaround() != wxFONTENCODING_UTF8 ) { // TODO: set encoding to UTF-8 (but keeping the current language) // ourselves