From 31065d0edff4f6153810db7ec49b21a1339fc24a Mon Sep 17 00:00:00 2001 From: BINDUCHAITANYA TUMMALA Date: Sun, 7 Jul 2013 17:03:31 +0530 Subject: [PATCH] making json number locale independent in compose. Change-Id: Icfe055b2c98fea401794e169579dcf6683706902 Signed-off-by: BINDUCHAITANYA TUMMALA --- src/FWebJson_JsonWriterImpl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/FWebJson_JsonWriterImpl.cpp b/src/FWebJson_JsonWriterImpl.cpp index 0e4a6a2..770c682 100755 --- a/src/FWebJson_JsonWriterImpl.cpp +++ b/src/FWebJson_JsonWriterImpl.cpp @@ -21,6 +21,7 @@ * * This file contains the definition of _JsonWriterImpl class. */ +#include #include #include #include @@ -387,10 +388,22 @@ _JsonWriterImpl::JsonNumberToString(double value, String& numString) return E_INVALID_DATA; } + locale_t _locale = 0; + char* pLocale = "C"; + + _locale = newlocale(LC_ALL, pLocale, null); + SysTryReturnResult(NID_BASE, _locale != null, E_SYSTEM, "Creating a new locale object failed."); + + uselocale(_locale); + wchar_t sValue[DBL_MAX_LENGTH + 1] = {0, }; swprintf(sValue, sizeof(sValue) / sizeof(sValue[0]), L"%.16lg", value); numString = String(sValue); + + freelocale(_locale); + uselocale(LC_GLOBAL_LOCALE); + return E_SUCCESS; } -- 2.7.4