summaryrefslogtreecommitdiffstats
path: root/src/value.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/value.c')
-rw-r--r--src/value.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/value.c b/src/value.c
index 85c9fd0..aed4f65 100644
--- a/src/value.c
+++ b/src/value.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
+#include <locale.h>
#include <raptor.h>
#include <slv2/value.h>
#include "slv2_internal.h"
@@ -42,6 +43,18 @@ slv2_value_new(SLV2World world, SLV2ValueType type, const char* str)
} else {
val->str_val = strdup(str);
}
+
+ /* Kludge decimal point to '.' for people in crazy locales that use ',' */
+ /* TODO: librdf should probably provide this... */
+ if (type == SLV2_VALUE_INT || type == SLV2_VALUE_FLOAT) {
+ struct lconv* locale = localeconv();
+ if (locale->decimal_point && strcmp(locale->decimal_point, ".")) {
+ assert(strlen(locale->decimal_point) == 1);
+ char* dec = strchr(str, locale->decimal_point[0]);
+ if (dec)
+ *dec = '.';
+ }
+ }
if (type == SLV2_VALUE_INT) {
char* endptr = 0;