Fixed to_lowercase().

Converting some text to lowercase caused range errors. I don't really
know what I'm doing here, so I replaced the code with this answer from
StackOverflow: <https://stackoverflow.com/a/21395>. It works now,
let's hope it stays that way.
This commit is contained in:
tastytea 2019-07-25 02:57:10 +02:00
parent f1c9f6d7ec
commit 21fe64b59c
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07

View File

@ -62,12 +62,12 @@ const vector<vector<string>> parse_expression(string expression)
const string to_lowercase(const string &str)
{
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::wstring in = converter.from_bytes(str);
std::wstring out;
std::transform(in.begin(), in.end(), std::back_inserter(out), ::towlower);
return converter.to_bytes(out);
string out;
std::locale loc("");
const std::ctype<char>& ct = std::use_facet<std::ctype<char>>(loc);
std::transform(str.begin(), str.end(), std::back_inserter(out),
std::bind1st(std::mem_fun(&std::ctype<char>::tolower), &ct));
return out;
}
const vector<Database::entry>