1
0
forked from mirrors/0ad

Fixes handling of UTF-8 encoded JSON files (stripping BOM if necessary). Fixes #1375.

This was SVN commit r11739.
This commit is contained in:
historic_bruno
2012-05-04 03:46:05 +00:00
parent a9faa59545
commit da4c1c8f2b
6 changed files with 67 additions and 27 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2012 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -1018,7 +1018,7 @@ CScriptValRooted ScriptInterface::ReadJSONFile(const VfsPath& path)
return CScriptValRooted();
}
std::string content(file.GetBuffer(), file.GetBuffer() + file.GetBufferSize()); // assume it's UTF-8
std::string content(file.DecodeUTF8()); // assume it's UTF-8
return ParseJSON(content);
}