mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-19 21:10:12 +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()))
|
||||
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);
|
||||
extractWhitespace(false);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user