mu: fix utf-8 flatten

This commit is contained in:
djcb 2019-03-24 11:43:51 +02:00
parent da10f30adf
commit bc891030f6
1 changed files with 6 additions and 8 deletions

View File

@ -105,16 +105,14 @@ Mux::utf8_flatten (const char *str)
if (!str)
return {};
bool is_ascii = true;
while (*str && is_ascii) {
is_ascii = *str & 0x80;
++str;
// the pure-ascii case
if (g_str_is_ascii(str)) {
auto l = g_ascii_strdown (str, -1);
std::string s{l};
g_free (l);
return s;
}
if (G_LIKELY(is_ascii))
return str;
///////////////////////////////////////////
// seems we need the big guns
char *flat = gx_utf8_flatten (str, -1);
if (!flat)