summaryrefslogtreecommitdiff
path: root/json-glib/json-generator.c
diff options
context:
space:
mode:
authorCornelius Hald <hald@icandy.de>2009-11-12 11:37:54 +0000
committerEmmanuele Bassi <ebassi@linux.intel.com>2009-11-12 11:37:54 +0000
commit7cebdd008a02e6cef0514f40327f94eba2a2088e (patch)
treed36dd878609ff9c91e195abea4a91c0c88364e9e /json-glib/json-generator.c
parent30d4efb775cb416212c00e3ececb0f0147739f40 (diff)
downloadjson-glib-7cebdd008a02e6cef0514f40327f94eba2a2088e.tar.gz
Doubles are converted to strings containing commas
Under some locales (e.g. de_DE) a double is converted to a string containing a comma instead of a dot. That breaks the JSON syntax. Example: Double: 0.34 is converted to 0,34 when using locale de_DE http://bugzilla.openedhand.com/show_bug.cgi?id=1826 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Diffstat (limited to 'json-glib/json-generator.c')
-rw-r--r--json-glib/json-generator.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/json-glib/json-generator.c b/json-glib/json-generator.c
index c17d97f..bad239b 100644
--- a/json-glib/json-generator.c
+++ b/json-glib/json-generator.c
@@ -306,7 +306,12 @@ dump_value (JsonGenerator *generator,
break;
case G_TYPE_DOUBLE:
- g_string_append_printf (buffer, "%f", g_value_get_double (&value));
+ {
+ gchar buf[65];
+
+ g_ascii_formatd (buf, 65, "%d", g_value_get_double (&value));
+ g_string_append (buffer, buf);
+ }
break;
case G_TYPE_BOOLEAN: