Skip to content

Commit 154652e

Browse files
authored
Merge pull request open-source-parsers#623 from bernhardHartleb/master
Fix open-source-parsers#567 in writing real values in different locales
2 parents 56efb6b + 4a9d77b commit 154652e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/lib_json/json_writer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int p
150150
// concepts of reals and integers.
151151
if (isfinite(value)) {
152152
len = snprintf(buffer, sizeof(buffer), formatString, value);
153-
153+
fixNumericLocale(buffer, buffer + len);
154+
154155
// try to ensure we preserve the fact that this was given to us as a double on input
155156
if (!strstr(buffer, ".") && !strstr(buffer, "e")) {
156157
strcat(buffer, ".0");
@@ -165,10 +166,8 @@ JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int p
165166
} else {
166167
len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999");
167168
}
168-
// For those, we do not need to call fixNumLoc, but it is fast.
169169
}
170170
assert(len >= 0);
171-
fixNumericLocale(buffer, buffer + len);
172171
return buffer;
173172
}
174173
}

0 commit comments

Comments
 (0)