fix serialisation of floating point numbers in SuperEasyJSON for german locale. JSON expects decimal points, but german locale used comma.

This commit is contained in:
electron128 2015-07-30 11:05:08 +02:00 committed by cave beat
parent 7a144c231b
commit ab25e35861

View File

@ -521,6 +521,15 @@ std::string SerializeValue(const Value& v)
case StringVal : str = "\"" + EscapeJSONString((std::string)v) + "\""; break;
}
// snprintf creates commas on german computers
// json expets decimal points, so replace all commas with decimal points
if(v.GetType() == FloatVal || v.GetType() == DoubleVal)
{
for(int i = 0; i < str.size(); i++)
if(str[i] == ',')
str[i] = '.';
}
return str;
}