This patch sets LC_NUMERIC variable to "C" to make sure JSON output (as
displayed by sadf -j) is locale-independent and floating-point values
use a decimal point.
This should make JSON output compliant with RFC7159.
Reported-by: @andy-maier
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
long cnt = 1;
off_t fpos;
+ if (format == F_JSON_OUTPUT) {
+ /* Use a decimal point to make JSON code compliant with RFC7159 */
+ setlocale(LC_NUMERIC, "C");
+ }
+
/* Save current file position */
if ((fpos = lseek(ifd, 0, SEEK_CUR)) < 0) {
perror("lseek");