mu: fix utf-8 flatten
This commit is contained in:
@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user