Skip to content

Commit

Permalink
Support IDN in mailto scheme in hyperlink tooltips
Browse files Browse the repository at this point in the history
in mailto scheme IDN coding may apply only to domain part
local part if not in ASCII must be unicode
  • Loading branch information
geo-stark authored and raveit65 committed Aug 31, 2023
1 parent 649935a commit eed62e8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/terminal-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit eed62e8

Please sign in to comment.