Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Background

A while ago it became possible to use the letters æ, ø and å in URLs, and some websites, like the encyclopaedia Store Norske Leksikon, has made use of this.

Recently, a question was posted on a Norwegian forum about creating a hyperlink to such an URL, something that doesn't work, at least not with æ and ø.

An example

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{hyperref}

\begin{document}
\url{http://snl.no/øl} \\
\url{http://snl.no/ære} \\
\url{http://snl.no/Ål}
\end{document}

The first two links do not work, they are printed as http://snl.no/\T1\ol and http://snl.no/\T1\aere, but the third one works as it should.

(One can get the correct URL printed by using the href command, but as the hyperlink is still wrong, that isn't really a solution.)

The question

I assume this has something to do with how hyperref handles non-english characters. Is there some way of making hyperref create a correct link with æ or ø in the url?

Update

By using the href command, and compiling with latex and the dvipdfm, the hyperlink is correct (see gerry's answer below). I've been compiling with pdflatex.

share|improve this question
    
Adding tags “url” and “unicode” could be helpful for people searching for this in future? –  Peter LeFanu Lumsdaine Dec 11 '10 at 17:20
    
You're right, I added those, as well as pdftex. Thanks for the suggestion. –  Torbjørn T. Dec 11 '10 at 17:53
    
I'd say this ought to work. Try asking on comp.text.tex. –  Philipp Dec 11 '10 at 18:09

3 Answers 3

up vote 6 down vote accepted

Actually I can get the right link with href. It's compiled with latex & dvi2pdf

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{hyperref}

\begin{document}
\href{http://snl.no/øl}{http://snl.no/øl}\\
\href{http://snl.no/ære}{http://snl.no/ære} \\
\href{http://snl.no/Ål}{http://snl.no/Ål}
\end{document}

alt text

share|improve this answer
1  
Indeed, it appears that this works. Thanks! I haven't compiled to DVI for a long time, so it didn't even occur to me to try. I'll wait a little, and see if anyone has a solution for using pdflatex. If not, I'll accept your answer. –  Torbjørn T. Dec 11 '10 at 15:20

With a small modification the answer given by gerry will even work directly with pdflatex:

\documentclass[a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage[]{hyperref}

\begin{document}
  \href{http://snl.no/%C3%B8l}{http://snl.no/øl} \\
  \href{http://snl.no/%C3%A6re}{http://snl.no/ære} \\
  \href{http://snl.no/%C3%85l}{http://snl.no/Ål}
\end{document}

You just have to encode the URL, for example using the W3 URL Encoder.

share|improve this answer

I get the same results with pdflatex, latex+dvips+ps2pdf and latex+dvipdfmx. In your place I would ask the author of hyperref. E.g. in comp.text.tex.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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