From: Hokwon Song Date: Tue, 9 Apr 2013 09:10:16 +0000 (+0900) Subject: Revert "Revert "[N_SE-32429,32965] Forcedly set the system locale to avoid a ICU... X-Git-Tag: accepted/tizen_2.1/20130425.034849~128^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8d0c2083967e3ce9ceeffefb2e55469ed16c5391;p=platform%2Fframework%2Fnative%2Fappfw.git Revert "Revert "[N_SE-32429,32965] Forcedly set the system locale to avoid a ICU defect"" This reverts commit a608d8b551973e17d3dfe9c1bcbb27e3aa647fa4 --- diff --git a/src/locales/FLcl_LocaleData.cpp b/src/locales/FLcl_LocaleData.cpp index 8c249f8..91f1861 100644 --- a/src/locales/FLcl_LocaleData.cpp +++ b/src/locales/FLcl_LocaleData.cpp @@ -21,7 +21,6 @@ */ // Includes -#include #include #include #include @@ -87,17 +86,14 @@ _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(""); } diff --git a/src/locales/FLcl_NumberFormatterImpl.cpp b/src/locales/FLcl_NumberFormatterImpl.cpp index 661899f..a1cb821 100644 --- a/src/locales/FLcl_NumberFormatterImpl.cpp +++ b/src/locales/FLcl_NumberFormatterImpl.cpp @@ -132,10 +132,14 @@ _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; }