+ // NB: We convert input file to wchar_t here in Unicode mode, based on
+ // either Content-Type header or <meta> tags. In ANSI mode, we don't
+ // do it as it is done by wxHtmlParser (for this reason, we add <meta>
+ // tag if we used Content-Type header).
+#if wxUSE_UNICODE
+ int charsetPos;
+ if ((charsetPos = file.GetMimeType().Find(_T("; charset="))) != wxNOT_FOUND)
+ {
+ wxString charset = file.GetMimeType().Mid(charsetPos + 10);
+ wxCSConv conv(charset);
+ ReadString(doc, s, conv);
+ }
+ else
+ {
+ wxString tmpdoc;
+ ReadString(tmpdoc, s, wxConvISO8859_1);
+ wxString charset = wxHtmlParser::ExtractCharsetInformation(tmpdoc);
+ if (charset.empty())
+ doc = tmpdoc;
+ else
+ {
+ wxCSConv conv(charset);
+ doc = wxString(tmpdoc.mb_str(wxConvISO8859_1), conv);
+ }
+ }
+#else // !wxUSE_UNICODE
+ ReadString(doc, s, wxConvLibc);