- wxString title = m_WParser->GetSource()->Mid(
- tag.GetBeginPos(),
- tag.GetEndPos1()-tag.GetBeginPos());
-#if !wxUSE_UNICODE && wxUSE_WCHAR_T
- wxCSConv conv(m_WParser->GetInputEncoding());
- title = wxString(title.wc_str(conv), wxConvLocal);
-#endif
+ wxString title(tag.GetBeginIter(), tag.GetEndIter1());
+#if !wxUSE_UNICODE
+ const wxFontEncoding enc = m_WParser->GetInputEncoding();
+ if ( enc != wxFONTENCODING_DEFAULT )
+ {
+ // need to convert to the current one
+ title = wxString(title.wc_str(wxCSConv(enc)), wxConvLocal);
+ }
+#endif // !wxUSE_UNICODE
+