making json number locale independent in compose.
authorBINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
Sun, 7 Jul 2013 11:33:31 +0000 (17:03 +0530)
committerBINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
Sun, 7 Jul 2013 11:33:31 +0000 (17:03 +0530)
Change-Id: Icfe055b2c98fea401794e169579dcf6683706902
Signed-off-by: BINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
src/FWebJson_JsonWriterImpl.cpp

index 0e4a6a2..770c682 100755 (executable)
@@ -21,6 +21,7 @@
  *
  * This file contains the definition of _JsonWriterImpl class.
  */
+#include <clocale>
 #include <new>
 #include <unique_ptr.h>
 #include <FBaseByteBuffer.h>
@@ -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;
 }