mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
browser: force UTF-8 by default for page encoding
This commit is contained in:
@@ -209,7 +209,8 @@ pub const Page = struct {
|
|||||||
// https://html.spec.whatwg.org/#read-html
|
// https://html.spec.whatwg.org/#read-html
|
||||||
fn loadHTMLDoc(self: *Page, reader: anytype) !void {
|
fn loadHTMLDoc(self: *Page, reader: anytype) !void {
|
||||||
log.debug("parse html", .{});
|
log.debug("parse html", .{});
|
||||||
const html_doc = try parser.documentHTMLParse(reader);
|
// TODO pass an encoding detected from HTTP headers.
|
||||||
|
const html_doc = try parser.documentHTMLParse(reader, "UTF-8");
|
||||||
const doc = parser.documentHTMLToDocument(html_doc);
|
const doc = parser.documentHTMLToDocument(html_doc);
|
||||||
|
|
||||||
// save a document's pointer in the page.
|
// save a document's pointer in the page.
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ pub fn HTMLFileTestFn(out: File) !void {
|
|||||||
const file = try std.fs.cwd().openFile("test.html", .{});
|
const file = try std.fs.cwd().openFile("test.html", .{});
|
||||||
defer file.close();
|
defer file.close();
|
||||||
|
|
||||||
const doc_html = try parser.documentHTMLParse(file.reader());
|
const doc_html = try parser.documentHTMLParse(file.reader(), "UTF-8");
|
||||||
// ignore close error
|
// ignore close error
|
||||||
defer parser.documentHTMLClose(doc_html) catch {};
|
defer parser.documentHTMLClose(doc_html) catch {};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user