mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-17 10:59:38 -04:00
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:
parent
7a144c231b
commit
ab25e35861
1 changed files with 9 additions and 0 deletions
|
@ -521,6 +521,15 @@ std::string SerializeValue(const Value& v)
|
||||||
case StringVal : str = "\"" + EscapeJSONString((std::string)v) + "\""; break;
|
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;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue