mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Ignore BOM at the start of json file
This commit is contained in:
parent
f86708bf37
commit
57eece233b
@ -40,6 +40,11 @@ JsonNode JsonParser::parse(const std::string & fileName)
|
|||||||
if(!TextOperations::isValidUnicodeString(input.data(), input.size()))
|
if(!TextOperations::isValidUnicodeString(input.data(), input.size()))
|
||||||
error("Not a valid UTF-8 file", false);
|
error("Not a valid UTF-8 file", false);
|
||||||
|
|
||||||
|
// If file starts with BOM - skip it
|
||||||
|
uint32_t firstCharacter = TextOperations::getUnicodeCodepoint(input.data(), input.size());
|
||||||
|
if (firstCharacter == 0xFEFF)
|
||||||
|
pos += TextOperations::getUnicodeCharacterSize(input[0]);
|
||||||
|
|
||||||
extractValue(root);
|
extractValue(root);
|
||||||
extractWhitespace(false);
|
extractWhitespace(false);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user