Apparently g_uri_unescape_string can return invalid UTF8, so
until we can replace or fix it, we double check to avoid
crashing in g_markup_escape_text and other places.
if (!unescaped)
return g_strdup (uri);
+ else if (!g_utf8_validate (unescaped, -1, NULL))
+ {
+ g_free (unescaped);
+ return g_strdup (uri);
+ }
hostname = sokoke_hostname_from_uri (unescaped, &path);
decoded = g_hostname_to_unicode (hostname);
if (!unescaped)
return g_strdup (uri);
+ else if (!g_utf8_validate (unescaped, -1, NULL))
+ {
+ g_free (unescaped);
+ return g_strdup (uri);
+ }
if (!idna_to_unicode_8z8z (unescaped, &decoded, 0) == IDNA_SUCCESS)
return unescaped;