From 8df3aad1239eb8d267b94c65a4b4092ce8f546ff Mon Sep 17 00:00:00 2001 From: "shy81.shin" Date: Fri, 26 Apr 2013 17:33:25 +0900 Subject: [PATCH] fix NaN issue on lang and region --- i18n/digitlst.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) mode change 100644 => 100755 i18n/digitlst.cpp diff --git a/i18n/digitlst.cpp b/i18n/digitlst.cpp old mode 100644 new mode 100755 index 1ae9027..d118036 --- a/i18n/digitlst.cpp +++ b/i18n/digitlst.cpp @@ -741,6 +741,14 @@ DigitList::set(double source) sprintf(rep, "%+1.*e", MAX_DBL_DIGITS - 1, source); U_ASSERT(uprv_strlen(rep) < sizeof(rep)); + // uprv_decNumberFromString() will parse the string expecting '.' as a + // decimal separator, however sprintf() can use ',' in certain locales. + // Overwrite a ',' with '.' here before proceeding. + char *decimalSeparator = strchr(rep, ','); + if (decimalSeparator != NULL) { + *decimalSeparator = '.'; + } + // Create a decNumber from the string. uprv_decNumberFromString(fDecNumber, rep, &fContext); uprv_decNumberTrim(fDecNumber); -- 2.7.4