# minted chokes on umlauts

I would like to use ü in the caption of my listings. It works with the lstinputlisting command, but not with inputminted:

\documentclass[11pt]{report}
\usepackage{geometry}
\geometry{a4paper, left=2cm, right=2cm, top=2cm, bottom=2cm}
\usepackage[utf8]{inputenc}
\usepackage{setspace}
\usepackage[ngerman]{babel}
\usepackage{color}
\usepackage{minted}

\newcommand{\code}[4][text]{
\inputminted[label=#3, frame=lines, framesep=2mm]{#1}{#2}
}

\begin{document}

\code[make]{makefile}{Gemeinheiten für Listing \ref{code:auto-einfach}}{code:gemeinheiten}

\end{document}


Makefile:

Bericht.pdf: Bericht.tex
pdflatex -shell-escape \$<


This is the error when I use pdflatex on that.

*** Error while highlighting:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 23: ordinal not in range(128)
(file "/usr/lib/python2.7/codecs.py", line 351, in write)
(./Bericht.out.pyg)
Runaway argument?
commandchars=\\\{\}
! File ended while scanning use of \FV@GetKeyValues.
<inserted text>
\par
l.16 ...ref{code:auto-einfach}}{code:gemeinheiten}


The error disappears when I remove the ü.

How can I get this to work with umlauts?

-
Please provide some more information about your document's settings, such as the document class you use, any font and text encoding commands, and which other packages you load in addition. It's usually a good idea to post a full MWE (minimum working example) that illustrates the problem at hand; doing so lets other readers a lot of unproductive guesswork as to the source(s) of the problems being reported. –  Mico Dec 11 '11 at 17:05
Okay, done that. –  Martin Ueding Dec 11 '11 at 17:24
I don't understand your definition of \code: you declare 4 arguments (the first one, optional and the other three mandatory), but then in the definition you do nothing with #4? –  Gonzalo Medina Dec 11 '11 at 17:39
That is correct, I use \lstinputlisting as well, and that takes a fourth label argument. With minted, I currently do not use a float and therefore no label. –  Martin Ueding Dec 11 '11 at 18:15
FWIW I have no idea how Unicode and LaTeX (don’t) work together. I’ve tried understanding this issue myself but since it works with XeLaTeX, fixing it in plain LaTeX has no priority, although I am sympathetic to the trouble this causes. –  Konrad Rudolph Dec 11 '11 at 23:36

This isn't a well answer nevertheless I want to provide some statements.

First of all the problem isn't LaTeX or XeLaTeX. You examples doesn't work with XeLaTeX. The problem based on the handling in the terminal / by pygmentize. With the current settings you only work with ascii. Instead changing the behavior of pygmentize (probable latex.py) you should simple use

\code[make]{makefile}{Gemeinheiten f\"ur Listing \ref{code:auto-einfach}}{code:gemeinheiten}


To avoid this error.

Based on the given information (movement of the argument) this step isn't necessary if you work with fancyvrb or listings.

-
At the time I wrote this report I had one branch with listings and another with minted. The listings-branch did not have any color, just some bold keywords. pygmentize's output looks way better. I guess next time I will build my own float and use a makefile with pygmentize manually. –  Martin Ueding Feb 5 '12 at 16:24
@queueoverflow: You can customize all that with listings, too; it is just that the defaults of listings are not very colorful and a bit old-fashioned. Take a look into other listings-related questions here at tex.se (e.g., tex.stackexchange.com/questions/18376/… ) and into the (excellent!) listings documentation. –  Daniel Feb 5 '12 at 20:20
A colleague used plain listings but got color and other stuff there. I'll research that package a little more next time I use it. –  Martin Ueding Feb 6 '12 at 17:21