3

I am trying to make names with special Danish characters in email addresses look right in the email the address in a hyperref link in the document compiled to PDF. I have attempted:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[unicode]{hyperref}

\begin{document}

\href{mailto:Ole-Bent Kjær <some.address@some.domain.dk>}{some.address}@some.domain.dk

\end{document}

I found and tried this answer: https://stackoverflow.com/a/4697003/865169 and this: https://tex.stackexchange.com/a/111796/13780 to fix it, with no luck. The link in the resulting PDF file turns out mailto:Ole-Bent Kj\T1\ae r <some.address@some.domain.dk>. Is this a PDF problem that I cannot solve from LaTeX?

Thomas Arildsen
  • 1,855
  • 1
  • 19
  • 27
  • I don't think the issue here is mailto: as you see the same with æ (or \ae) in a standard link. I suspect that only some chars can be handled by the unicode option within hyperlinks (although the same char seems to be fine in the TOC bookmarks). I can't find any comment on the coverage in the docs, so I guess we need Heiko to answer! – Joseph Wright Sep 16 '14 at 10:32

1 Answers1

4

As mailto: is a URI scheme, the rules for handling special characters are identical to those for URLs, which themselves also are URIs. Therefore one can use the so-called percent-encoding, which substitutes special characters by sequences of a percent sign followed by its UTF-8 byte sequence. For æ, this byte sequence is C3 A6, therefore its percent encoding would be %C3%A6. But as LaTeX takes the percent sign for the beginning of a comment, one has to escape it with a backslash, as well. After these steps, the result is the following:

\href{mailto:Ole-Bent Kj\%C3\%A6r <some.address@some.domain.dk>}{some.address}@some.domain.dk

Now, if the link is hovered over or clicked, the correct æ will show instead of \%C3\%A6.

See also here: Hyperref: Scandinavian characters (æø) don't work in \url, hyperlink is wrong

brian-ammon
  • 2,425
  • 1
  • 21
  • 35