summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Stark <[email protected]>2023-03-12 12:30:49 +0300
committerraveit65 <[email protected]>2023-08-31 14:25:41 +0200
commiteed62e83c1cecaa32af2864dd413b9df5c178174 (patch)
tree17b6fb2be46429096531a3c029e00b4d122641bf /src
parent649935a610d4f97ad99f98fed2facffdd5be5265 (diff)
downloadmate-terminal-eed62e83c1cecaa32af2864dd413b9df5c178174.tar.bz2
mate-terminal-eed62e83c1cecaa32af2864dd413b9df5c178174.tar.xz
Support IDN in mailto scheme in hyperlink tooltips
in mailto scheme IDN coding may apply only to domain part local part if not in ASCII must be unicode
Diffstat (limited to 'src')
-rw-r--r--src/terminal-util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/terminal-util.c b/src/terminal-util.c
index d0f1864..3e32a69 100644
--- a/src/terminal-util.c
+++ b/src/terminal-util.c
@@ -754,6 +754,25 @@ char *terminal_util_hyperlink_uri_label (const char *uri)
}
g_free(unidn);
}
+ if (g_ascii_strncasecmp(unesc, "mailto:", 7) == 0)
+ {
+ const char *hostname = strchr(unesc, '@');
+ if (hostname != NULL)
+ {
+ const char *unidn = g_hostname_to_unicode(++hostname);
+ replace_hostname = unidn != NULL && g_ascii_strcasecmp(unidn, hostname) != 0;
+ if (replace_hostname)
+ {
+ char *new_unesc = g_strdup_printf("%.*s%s",
+ (int) (hostname - unesc),
+ unesc,
+ unidn);
+ g_free(unesc);
+ unesc = new_unesc;
+ }
+ g_free(unidn);
+ }
+ }
return unesc;
}