mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 22:24:57 +00:00
LibWeb: Set the encoding of HTML documents
Now that we attach the document to the frame before parsing, we have to make sure we set the encoding on the document before parsing, or things may not turn out well.
This commit is contained in:
parent
024059b49b
commit
7b735b55e1
2 changed files with 3 additions and 2 deletions
|
@ -113,7 +113,7 @@ static Vector<FlyString> s_quirks_public_ids = {
|
|||
RefPtr<DOM::Document> parse_html_document(const StringView& data, const URL& url, const String& encoding)
|
||||
{
|
||||
auto document = DOM::Document::create(url);
|
||||
HTMLDocumentParser parser(document, data, TextCodec::get_standardized_encoding(encoding));
|
||||
HTMLDocumentParser parser(document, data, encoding);
|
||||
parser.run(url);
|
||||
return document;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ HTMLDocumentParser::HTMLDocumentParser(DOM::Document& document, const StringView
|
|||
: m_tokenizer(input, encoding)
|
||||
, m_document(document)
|
||||
{
|
||||
m_document->set_encoding(encoding);
|
||||
m_document->set_encoding(TextCodec::get_standardized_encoding(encoding));
|
||||
}
|
||||
|
||||
HTMLDocumentParser::~HTMLDocumentParser()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue