Skip to content

Commit 1d8bdc8

Browse files
author
James McLaughlin
committed
Skip the UTF-8 byte order mark if present
1 parent 13ef5a8 commit 1d8bdc8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

json.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,16 @@ json_value * json_parse_ex (json_settings * settings,
218218
long num_digits = 0, num_e = 0;
219219
json_int_t num_fraction = 0;
220220

221+
/* Skip UTF-8 BOM
222+
*/
223+
if (length >= 3 && json [0] == 0xEF
224+
&& json [1] == 0xBB
225+
&& json [2] == 0xBF)
226+
{
227+
json += 3;
228+
length -= 3;
229+
}
230+
221231
error[0] = '\0';
222232
end = (json + length);
223233

0 commit comments

Comments
 (0)