diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index b442126..73a36f5 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -915,7 +915,7 @@ TEST(document_contents_preserve_latin1)
{
// parse into document (preserve comments, declaration and whitespace pcdata)
xml_document doc;
- CHECK(doc.load_buffer(files[src].data, files[src].size, parse_default | parse_ws_pcdata | parse_declaration | parse_comments, files[src].encoding));
+ CHECK(doc.load_buffer(files[src].data, files[src].size, parse_default | parse_ws_pcdata | parse_declaration | parse_comments));
// compare saved document with the original (raw formatting, without extra declaration, write bom if it was in original file)
CHECK(test_save_narrow(doc, format_raw | format_no_declaration | format_write_bom, files[dst].encoding, files[dst].data, files[dst].size));
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp
index dc709a2..62fbbce 100644
--- a/tests/test_parse.cpp
+++ b/tests/test_parse.cpp
@@ -1182,3 +1182,27 @@ TEST(parse_embed_pcdata)
CHECK_NODE_EX(doc, STR("\n\tvalue\n\t\n\t\tvalue1\n\t\tvalue2outer\n\ttext\n\t\n\n"), STR("\t"), format_indent);
}
}
+
+TEST(parse_encoding_detect)
+{
+ char test[] = "";
+
+ xml_document doc;
+ CHECK(doc.load_buffer(test, sizeof(test)));
+}
+
+TEST(parse_encoding_detect_latin1)
+{
+ char test0[] = "";
+ char test1[] = "";
+ char test2[] = "";
+ char test3[] = "";
+ char test4[] = "";
+
+ xml_document doc;
+ CHECK(doc.load_buffer(test0, sizeof(test0)).encoding == encoding_utf8);
+ CHECK(doc.load_buffer(test1, sizeof(test1)).encoding == encoding_latin1);
+ CHECK(doc.load_buffer(test2, sizeof(test2)).encoding == encoding_latin1);
+ CHECK(doc.load_buffer(test3, sizeof(test3)).encoding == encoding_latin1);
+ CHECK(doc.load_buffer(test4, sizeof(test4)).encoding == encoding_latin1);
+}
\ No newline at end of file