10

Let's consider this MNWE (Minimal Not Working example):

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage[spanish]{babel} % with or without, same problem
\usepackage{pdfpages}
\begin{document}

  \includepdf{plain_chars.pdf}

  \includepdf{accénted_chars.pdf}

\end{document}

In the directory the two PDF files exists (they are the same):

-rw-rw-r-- 1 romano romano 4726 Jun 16 16:13 accénted_chars.pdf
-rw-rw-r-- 1 romano romano 4726 Jun 16 16:07 plain_chars.pdf

I am using pdflatex on a standard Ubuntu 14.04 installation, and I have:

! Package pdfpages Error: Cannot find file `acc\IeC {\'e}nted_chars.pdf'.

See the pdfpages package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.10   \includepdf{accénted_chars.pdf}

At first I thought it was a problem with babel, but then I commented it out and it still is not working.

Is it possible to convince \includepdf{} to accept file names with non-ascii char in their name?

Rmano
  • 40,848
  • 3
  • 64
  • 125

1 Answers1

8

Using non ASCII characters in file names is not recommended, because they involve delicate communication between various parts of the operating system or running applications and in some cases it can happen that they don't understand each other.

The trick

\includepdf{\detokenize{accénted_chars.pdf}}

might work, depending on your operating system.

egreg
  • 1,121,712
  • It works on Linux and ext4 - as far as I know, standard Linux filesystems are encoding-agnostic, they just see strings of bytes. But I agree that this will be OS dependent and probably even filesystem dependent. – Rmano Jun 17 '14 at 13:38
  • 1
    @Rmano I tried it on Mac OS X; about the caveat, I was thinking to an OS that I don't use and I won't mention the name of. ;-) – egreg Jun 17 '14 at 13:39
  • includepdf happens to expand its arguments, but maybe do \ExpandArgs{o}\includepdf{...} (or the expandafter equivalent) just in case. – user202729 Jun 13 '22 at 12:46