Make URI highlighting in textview and compose Unicode-aware.
[claws.git] / src / common / utils.c
index f288888917d060d3780b854626cc0474ff28061b..5774c4dd1dd02b1d11086290a5d0b9c3593435e7 100644 (file)
@@ -3404,9 +3404,10 @@ gboolean get_uri_part(const gchar *start, const gchar *scanpos,
        *bp = scanpos;
 
        /* find end point of URI */
-       for (ep_ = scanpos; *ep_ != '\0'; ep_++) {
-               if (!g_ascii_isgraph(*(const guchar *)ep_) ||
-                   !IS_ASCII(*(const guchar *)ep_) ||
+       for (ep_ = scanpos; *ep_ != '\0'; ep_ = g_utf8_next_char(ep_)) {
+               gunichar u = g_utf8_get_char_validated(ep_, -1);
+               if (!g_unichar_isgraph(u) ||
+                   u == (gunichar)-1 ||
                    strchr("[]{}<>\"", *ep_)) {
                        break;
                } else if (strchr("(", *ep_)) {