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?

  • 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
3

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

  • Actually it even works without escaping the percent signs, i. e., Kj%C3%A6r is also an option. – brian-ammon Sep 16 '14 at 10:35
  • This sort of works for me; in my example, the link says "mailto:Ole-Bent Kj%C3%A6r <some.address@some.domain.dk>" when hovered in the PDF, but it does get translated to "æ" in the email client when clicked. Maybe this is an issue with the PDF viewer (evince)? – Thomas Arildsen Sep 17 '14 at 9:53
  • I only tried Adobe’s own reader, so you might be right about that. – brian-ammon Sep 27 '14 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.