forked from townforge/townforge
game: better history text canonicalization (should work with UTF-8)
This commit is contained in:
parent
9b6915640b
commit
5c433b3efc
@ -2825,13 +2825,24 @@ void UIPlayerInfoDialog::HandleListHeaderResized(StringHash eventType, VariantMa
|
||||
}
|
||||
|
||||
UIPlayerInfoDialog::HistoryItem::HistoryItem(const TBStr &s):
|
||||
tb::TBGenericStringItem(s),
|
||||
canonical(s)
|
||||
tb::TBGenericStringItem(s)
|
||||
{
|
||||
const int len = canonical.Length();
|
||||
char *ptr = canonical.CStr();
|
||||
for (int i = 0; i < len; ++i)
|
||||
ptr[i] = tolower(ptr[i]);
|
||||
try
|
||||
{
|
||||
canonical = tools::utf8canonical(std::string(s.CStr()), [](wint_t c) -> wint_t {
|
||||
if (c >= 32 && c < 128)
|
||||
return tolower(c);
|
||||
return c;
|
||||
}).c_str();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
canonical = s;
|
||||
const int len = canonical.Length();
|
||||
char *ptr = canonical.CStr();
|
||||
for (int i = 0; i < len; ++i)
|
||||
ptr[i] = tolower(ptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool UIPlayerInfoDialog::HistorySource::Filter(int index, const TBStr &filter)
|
||||
|
Loading…
Reference in New Issue
Block a user