# pdflatex, breakurl and unicode characters

I am trying to write an URL using breakurl, that includes an accented character. I am trying to use pdflatex with utf8 inputenc (also tried utf8x). But I can't get a decent result.

My best result is presented by this minimal working example:

\documentclass{article}

\usepackage[utf8x]{inputenc}
\usepackage{hyperref}
\usepackage{url}

\begin{document}
\url{\detokenize{http://coração.net}}

\end{document}


The link is created correctly, but the text shown in the PDF is not the correct one (misses the non ascii characters).

Suggestions are welcome.

• \detokenize will completely break pdflatex's handling of utf-8. Dec 18, 2017 at 16:20
• Sure, but removing it doesn't help too. Dec 18, 2017 at 16:26
• Why do you need that? I don't think url with non-ascii characters are supported anywhere (feel free to correct me about this). Also there is no need to load url if you load hyperref. Dec 18, 2017 at 16:33
• \href{\detokenize{http://coração.net}}{\texttt{http://coração.net}}
– user91669
Dec 18, 2017 at 16:36
• @Skillmon unfortunately unicode domains are out there, and they are a big danger for phishing, as there are ways to make similar looking urls pointing to different places. Look here: wordfence.com/blog/2017/04/chrome-firefox-unicode-phishing Dec 18, 2017 at 16:41

There are at least two issues here. First, you need to switch to the 8-bit T1 encoding, or PDFTeX will by default use an even older 7-bit encoding for output. Second, hyperref declares its own \url command and does not seem to be compatible with \usepackage{url}.

The following workaround appeared to work for me:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % The default since 2018.
\usepackage[unicode]{hyperref}

\begin{document}
\href{http://cora\%E7\%E3o.net}{\texttt{http://coração.net}}
\end{document}


The following code works with xelatex:

\documentclass{article}
\usepackage{fontspec,hyperref}
\begin{document}
\url{http://coração.net}
\end{document}

• Yep, unfortunately I needed to use pdflatex. Dec 18, 2017 at 17:23