+ m_textctrl->LoadFile(filename);
+
+ if ( fontenc == wxFONTENCODING_UTF8 ||
+ !wxTheFontMapper->IsEncodingAvailable(fontenc) )
+ {
+ // try to find some similar encoding:
+ wxFontEncoding encAlt;
+ if ( wxTheFontMapper->GetAltForEncoding(fontenc, &encAlt) )
+ {
+ wxEncodingConverter conv;
+
+ if (conv.Init(fontenc, encAlt))
+ {
+ fontenc = encAlt;
+ m_textctrl -> SetValue(conv.Convert(m_textctrl -> GetValue()));
+ }
+ else
+ {
+ wxLogWarning("Cannot convert from '%s' to '%s'.",
+ wxFontMapper::GetEncodingDescription(fontenc).c_str(),
+ wxFontMapper::GetEncodingDescription(encAlt).c_str());
+ }
+ }
+ else
+ wxLogWarning("No fonts for encoding '%s' on this system.",
+ wxFontMapper::GetEncodingDescription(fontenc).c_str());
+ }
+