mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user