From d8f4c69a016ea54eb5a8e95702f2f665f66f3c8d Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 1 Dec 2011 18:49:30 +0000 Subject: [PATCH] - ensure locale is properly set when converting numbers --- source/shared_lib/sources/util/conversion.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/shared_lib/sources/util/conversion.cpp b/source/shared_lib/sources/util/conversion.cpp index aae5d787a..c565e185e 100644 --- a/source/shared_lib/sources/util/conversion.cpp +++ b/source/shared_lib/sources/util/conversion.cpp @@ -117,12 +117,16 @@ string intToHex(int i){ } string floatToStr(float f,int precsion) { + setlocale(LC_NUMERIC, "C"); + char str[strSize]=""; snprintf(str, strSize-1, "%.*f", precsion,f); return (str[0] != '\0' ? str : ""); } string doubleToStr(double d,int precsion) { + setlocale(LC_NUMERIC, "C"); + char str[strSize]=""; snprintf(str, strSize-1, "%.*f", precsion,d); return (str[0] != '\0' ? str : "");