From eed62e83c1cecaa32af2864dd413b9df5c178174 Mon Sep 17 00:00:00 2001 From: George Stark Date: Sun, 12 Mar 2023 12:30:49 +0300 Subject: 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 --- src/terminal-util.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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; } -- cgit v1.2.1