Correct conversion from text file to charset (which is read in that text file)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2009-01-23 22:19:46 +00:00
parent 8680ee061f
commit 08f744fb3b

View File

@@ -153,15 +153,19 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const
}
else
{
wxString tmpdoc;
ReadString(tmpdoc, s, wxConvISO8859_1);
size_t size = s->GetSize();
wxCharBuffer buf( size+1 );
s->Read( buf.data(), size );
*(buf.data() + size) = 0;
wxString tmpdoc( buf, wxConvISO8859_1);
wxString charset = wxHtmlParser::ExtractCharsetInformation(tmpdoc);
if (charset.empty())
doc = tmpdoc;
else
{
wxCSConv conv(charset);
doc = wxString(tmpdoc.mb_str(wxConvISO8859_1), conv);
doc = wxString( buf, conv );
}
}
#else // !wxUSE_UNICODE