mu: fix utf-8 flatten

This commit is contained in:
djcb
2019-03-24 11:43:51 +02:00
parent da10f30adf
commit bc891030f6

View File

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