# Umlauts in filenames using the grffile package

"Never ever use non-ASCII characters and spaces in your filenames. Never!"

That's what I'm telling my students for years. But if for any reasons there is an urgent need to include an image file with umlauts in its filename, the grffile package could be used.

Unfortunately, I was not able to get the following example compiled:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{graphicx}
\usepackage[extendedchars]{grffile}

\begin{document}

\includegraphics{Bäckerstraße}

\end{document}


I'm using MiKTeX (recently updated) upon Windows 7. My MWE is saved in Cp1252 Windows encoding. The same is valid for the existing file Bäckerstraße.png on my file system.

I compiled with pdflatex. The compilation produces no PDF output with no error message in the log file. The compilations stops with an error message in the command shell:

pdflatex: Windows API error 1113: F��r das Unicode-Zeichen ist kein zugeordnetes Zeichen in der Mehrbytecodepage vorhanden.

I googled for this problem and found some forum discussion from 2011 and 2012 indicating that this could be a general pdflatex problem using MiKTeX.

I'm asking, if there is just a dumb error of mine inside the MWE code or if there is just no chance to run this with MiKTeX.

If there is an error in the MWE, please, let me know how to correct it. But if this cannot run at all, please, stop me wasting time trying.

• Well, under Linux it works without problems...
– user31729
Nov 23 '14 at 10:36
• @ChristianHupfer I think this could be MiKTeX-specific. mrunix.de/forums/… contains some discussion in this direction (dating from 2011). Nov 23 '14 at 10:41
• Unfortunately I can't test your issue more specifically... I neither use MikTeX nor Windows (;-))
– user31729
Nov 23 '14 at 10:42
• No, miktex doesn't like non-ascii-chars (imho the problem did disappear sometime ago and then reappeared again). I wouldn't waste time on it. Nov 23 '14 at 10:42
• @UlrikeFischer Thank you for the information. I thought I could try some nice LaTeX image examples before sunday lunch, but this obviously was a bad idea. If you provide your comment as an answer, I will accept it. Nov 23 '14 at 10:55

Since the file name encoding seems to be UTF-8, the file name needs to be reencoded from Latin-1 to UTF-8. This is also supported by package grffile:

\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage[encoding,filenameencoding=utf8]{grffile}

\begin{document}
\includegraphics{Bäckerstraße}
\end{document}


Alternatively the TeX source could be encoded in UTF-8 entirely.

BTW, the full range of code page for CP 1252 is provided by options ansinew or x-cp1252 for package inputenc (the latter option comes from package inputenx and can be used as cp1252 there).