Merge pull request #2518 from mpimenov/emoji

[search] Fixed emoji.
This commit is contained in:
Viktor Govako 2016-03-25 13:55:52 +03:00
commit e717a3aef7
2 changed files with 9 additions and 2 deletions

View file

@ -1565,7 +1565,7 @@ fi:3Näköalatasanne|nähtävyydet
sw:Genge|utalii
tourism-information
en:4Tourist Information|4information|sights|U+2139|U+1F481
en:4Tourist Information|4information|sights|U+1F481
ru:4Туринформация|информация|достопримечательность
uk:4Турінформація|інформація|пам’ятка|пам’ятні місця
de:4Tourist-Information|Information|Sehenswürdigkeit

View file

@ -154,14 +154,21 @@ void CategoriesHolder::LoadFromStream(istream & s)
using namespace strings;
if (StartsWith(name.m_name, "U+"))
{
auto const code = name.m_name;
int c;
if (!to_int(name.m_name.c_str() + 2, c, 16))
{
LOG(LWARNING, ("Bad emoji code:", name.m_name));
LOG(LWARNING, ("Bad emoji code:", code));
continue;
}
name.m_name = ToUtf8(UniString(1, static_cast<UniChar>(c)));
if (IsASCIIString(ToUtf8(search::NormalizeAndSimplifyString(name.m_name))))
{
LOG(LWARNING, ("Bad emoji code:", code));
continue;
}
}
cat.m_synonyms.push_back(name);