mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +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
Notes:
sideshowbarker
2024-07-19 00:53:24 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7b735b55e11
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()
|
||||
|
|
|
@ -260,6 +260,7 @@ void FrameLoader::resource_did_load()
|
|||
|
||||
auto document = DOM::Document::create();
|
||||
document->set_url(url);
|
||||
document->set_encoding(resource()->encoding());
|
||||
document->set_content_type(resource()->mime_type());
|
||||
|
||||
frame().set_document(document);
|
||||
|
|
Loading…
Reference in a new issue