diff options
author | vng <viktor.govako@gmail.com> | 2015-09-01 16:25:57 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:04:11 +0300 |
commit | 6d58c2a583337f05fc310373c027232e0f3958f4 (patch) | |
tree | 6b4fc620789b5be9aba9ad146a95a563a4c54f44 /indexer | |
parent | 6206cdd7742d481fc45c4b5fd7389769be177ea7 (diff) |
[search] Process emoji symbols like the search categories.
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/categories_holder.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/indexer/categories_holder.cpp b/indexer/categories_holder.cpp index e1d6dd546c..d07dea2c36 100644 --- a/indexer/categories_holder.cpp +++ b/indexer/categories_holder.cpp @@ -150,6 +150,20 @@ void CategoriesHolder::LoadFromStream(istream & s) else name.m_prefixLengthToSuggest = Category::EMPTY_PREFIX_LENGTH; + // Process emoji symbols. + using namespace strings; + if (StartsWith(name.m_name, "U+")) + { + int c; + if (!to_int(name.m_name.c_str() + 2, c, 16)) + { + LOG(LWARNING, ("Bad emoji code:", name.m_name)); + continue; + } + + name.m_name = ToUtf8(UniString(1, static_cast<UniChar>(c))); + } + cat.m_synonyms.push_back(name); } } |