From 9491eee6d88f2b75ed40c04096a151be4f729059 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Sat, 20 Sep 2014 10:04:48 +0900 Subject: [PATCH] Fix bug scim_split_string_list return en if string includes blank [model] Kiran, B3 [binary_type] PDA [customer] OPEN [issue#] P140916-01665 [problem] English is dispalyed multiple time under samsung keyboard settings. [cause] scim_split_string_list return en if string includes blank [solution] Remove blank in language list [team] Input Framework [request] N/A [horizontal_expansion] N/A Change-Id: Ieb0e784521c148ce999c1ba4e120c7b6b9813c64 --- ism/src/scim_utility.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ism/src/scim_utility.cpp b/ism/src/scim_utility.cpp index 11d9c5e..aa2765e 100644 --- a/ism/src/scim_utility.cpp +++ b/ism/src/scim_utility.cpp @@ -376,6 +376,20 @@ utf8_wcstombs (const ucs4_t *wstr, int len) return str; } +static String trim_blank (const String &str) +{ + String::size_type begin, len; + + begin = str.find_first_not_of (" \t\n\v"); + + if (begin == String::npos) + return String (); + + len = str.find_last_not_of (" \t\n\v") - begin + 1; + + return str.substr (begin, len); +} + EAPI String scim_validate_locale (const String& locale) { @@ -470,6 +484,7 @@ scim_split_string_list (std::vector& vec, const String& str, char delim) break; } temp.assign (bg, ed); + temp = trim_blank (temp); vec.push_back (temp); ++count; -- 2.7.4