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:
@@ -153,15 +153,19 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString tmpdoc;
|
size_t size = s->GetSize();
|
||||||
ReadString(tmpdoc, s, wxConvISO8859_1);
|
wxCharBuffer buf( size+1 );
|
||||||
|
s->Read( buf.data(), size );
|
||||||
|
*(buf.data() + size) = 0;
|
||||||
|
wxString tmpdoc( buf, wxConvISO8859_1);
|
||||||
|
|
||||||
wxString charset = wxHtmlParser::ExtractCharsetInformation(tmpdoc);
|
wxString charset = wxHtmlParser::ExtractCharsetInformation(tmpdoc);
|
||||||
if (charset.empty())
|
if (charset.empty())
|
||||||
doc = tmpdoc;
|
doc = tmpdoc;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxCSConv conv(charset);
|
wxCSConv conv(charset);
|
||||||
doc = wxString(tmpdoc.mb_str(wxConvISO8859_1), conv);
|
doc = wxString( buf, conv );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // !wxUSE_UNICODE
|
#else // !wxUSE_UNICODE
|
||||||
|
Reference in New Issue
Block a user