Revert "[N_SE-32429,32965] Forcedly set the system locale to avoid a ICU defect"
authorHokwon Song <hokwon.song@samsung.com>
Mon, 8 Apr 2013 13:50:39 +0000 (22:50 +0900)
committerGerrit Code Review <gerrit2@kim11>
Mon, 8 Apr 2013 13:50:39 +0000 (22:50 +0900)
This reverts commit a4c92cdc9007df9bd1e459760dbd973bfcb17b58

src/locales/FLcl_LocaleData.cpp
src/locales/FLcl_NumberFormatterImpl.cpp

index 91f1861..8c249f8 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 // Includes
+#include <locale.h>
 #include <memory>
 #include <stdlib.h>
 #include <unistd.h>
@@ -86,14 +87,17 @@ _LocaleData::GetIcuString(const String& ospStr)
 String
 _LocaleData::GetOspString(const IcuUnicodeString& icuStr)
 {
+       setlocale(LC_ALL, "C");
        int len = icuStr.length();                                  // get length
        if (len)                                                    // if icuStr is not empty
        {
                char out[len * 3 + 1];                                  // Create buffer of thrice the icuStr length
                int end = icuStr.extract(0, len, out);
                out[end] = 0;                   // icuStr.extract() converts Unicode to UTF8
+               setlocale(LC_ALL, "");
                return String(out);
        }
+       setlocale(LC_ALL, "");
        return String("");
 }
 
index a1cb821..661899f 100644 (file)
@@ -132,14 +132,10 @@ _NumberFormatterImpl::Format(long number, String& str, _FieldPosition pos) const
 result
 _NumberFormatterImpl::Format(double number, String& str, _FieldPosition pos) const
 {
-       /*TODO: ICU 4.8 did not replace "," by a locale. So, it returns NaN even if a number is not NaN.
-       We are setting and restoring a system locale to "C".
-       It should be removed if ICU version is up.*/
        setlocale(LC_ALL, "C");
        IcuUnicodeString icuStr;
        IcuFieldPosition icuPos = _LocaleData::GetIcuFieldPosition(pos);
        icuStr = __pIcuNumberFormatter->format(number, icuStr, icuPos);
-       setlocale(LC_ALL, "");
        str = _LocaleData::GetOspString(icuStr);
        return E_SUCCESS;
 }