Support for UTF-8 with BOM.

Fixes #65
This commit is contained in:
Krzysztof Gabis 2016-12-08 21:40:52 +00:00
parent b61c03e614
commit dcf85b88c8
2 changed files with 4 additions and 1 deletions

View File

@ -1004,6 +1004,9 @@ JSON_Value * json_parse_string(const char *string) {
if (string == NULL) {
return NULL;
}
if (string[0] == '\xEF' && string[1] == '\xBB' && string[2] == '\xBF') {
string = string + 3; /* Support for UTF-8 BOM */
}
return parse_value((const char**)&string, 0);
}

View File

@ -1,4 +1,4 @@
{
{
"string" : "lorem ipsum",
"utf string" : "\u006corem\u0020ipsum",
"utf-8 string": "あいうえお",