Change-Id: I2bb3ca5bf8376d55e7a51c79b7f19db49ce67ef3
Signed-off-by: Hokwon Song <hokwon.song@samsung.com>
*/
// Includes
-#include <locale.h>
#include <memory>
#include <stdlib.h>
#include <unistd.h>
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("");
}
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;
}