1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Skip UTF-8 BOM in FileStorage

This commit is contained in:
Vladislav Sovrasov
2016-11-01 12:24:30 +03:00
parent 6c12533160
commit 38483fe7a7
2 changed files with 37 additions and 2 deletions
+22
View File
@@ -928,3 +928,25 @@ TEST(Core_InputOutput, filestorage_json_comment)
EXPECT_EQ(str, String("value"));
}
TEST(Core_InputOutput, filestorage_utf8_bom)
{
EXPECT_NO_THROW(
{
String content ="\xEF\xBB\xBF<?xml version=\"1.0\"?>\n<opencv_storage>\n</opencv_storage>\n";
cv::FileStorage fs(content, cv::FileStorage::READ | cv::FileStorage::MEMORY);
fs.release();
});
EXPECT_NO_THROW(
{
String content ="\xEF\xBB\xBF%YAML:1.0\n";
cv::FileStorage fs(content, cv::FileStorage::READ | cv::FileStorage::MEMORY);
fs.release();
});
EXPECT_NO_THROW(
{
String content ="\xEF\xBB\xBF{\n}\n";
cv::FileStorage fs(content, cv::FileStorage::READ | cv::FileStorage::MEMORY);
fs.release();
});
}