diff --git a/src/dom/document.zig b/src/dom/document.zig index 22eac8d2..76d58158 100644 --- a/src/dom/document.zig +++ b/src/dom/document.zig @@ -54,10 +54,8 @@ pub const Document = struct { return "CSS1Compat"; } - // TODO implement characterSet pub fn get_characterSet(self: *parser.Document) []const u8 { - _ = self; - return "UTF-8"; + return parser.documentGetInputEncoding(self); } // alias of get_characterSet diff --git a/src/netsurf.zig b/src/netsurf.zig index 368e01f1..7afaafec 100644 --- a/src/netsurf.zig +++ b/src/netsurf.zig @@ -800,6 +800,12 @@ pub inline fn documentGetDocumentURI(doc: *Document) []const u8 { return stringToData(s.?); } +pub inline fn documentGetInputEncoding(doc: *Document) []const u8 { + var s: ?*String = undefined; + _ = documentVtable(doc).dom_document_get_input_encoding.?(doc, &s); + return stringToData(s.?); +} + pub inline fn documentCreateElement(doc: *Document, tag_name: []const u8) *Element { var elem: ?*Element = undefined; _ = documentVtable(doc).dom_document_create_element.?(doc, stringFromData(tag_name), &elem);