From: Hokwon Song Date: Thu, 11 Apr 2013 04:49:34 +0000 (+0900) Subject: Update converting UnicodeStriong to OspSting X-Git-Tag: accepted/tizen_2.1/20130425.034849~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0716c3e679e1be3488a612f487ab61dad4c029c3;p=framework%2Fosp%2Fappfw.git Update converting UnicodeStriong to OspSting Change-Id: I84d8a6d9f52b59266dfa2bc49338caddd25def03 Signed-off-by: Hokwon Song --- diff --git a/src/locales/FLcl_LocaleData.cpp b/src/locales/FLcl_LocaleData.cpp index 91f1861..1b129e1 100644 --- a/src/locales/FLcl_LocaleData.cpp +++ b/src/locales/FLcl_LocaleData.cpp @@ -21,6 +21,7 @@ */ // Includes +#include #include #include #include @@ -82,17 +83,24 @@ _LocaleData::GetIcuString(const String& ospStr) return icuStr; } + // This function convert ICU string to OSP string String _LocaleData::GetOspString(const IcuUnicodeString& icuStr) { int len = icuStr.length(); // get length - if (len) // if icuStr is not empty + if (len > 0) // 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 - return String(out); + wchar_t wstr[len + 1]; + IcuUnicodeString tmpIcuStr(icuStr); + for (int i = 0; i < len ; i++) + { + UChar icuChar; + icuChar = tmpIcuStr.charAt(i); + wstr[i] = (wchar_t)icuChar; + } + wstr[len] = 0; + return String(wstr); } return String(""); }