I wrote a small new command that makes use of \@currentlabelname and \nameref. When I have Umlauts in the labelname (the argument of \@currentlabelname) everything works fine until I use the fontenc package. Then the umlauts are not correctly escaped/transformed into the .aux-File, which then causes an inputenc error.
Here is a minimal example. Run twice to get the error! Any ideas how to make this work with fontenc?
\documentclass{scrartcl}
\usepackage[T1]{fontenc} %causes Umlauts in -aux-file and therefore an inputenc-error on the second run
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\makeatletter
\newcommand\AP[1]{%
\subsubsection*{#1}%
\edef\@currentlabelname{#1}%
}
\makeatother
\begin{document}
\AP{endgültig}
\label{foo}
\nameref{foo}
\end{document}
\label. – egreg Dec 13 '13 at 14:18