# datatool package: wishing for keys / column names with special characters, can't get it to work

I wish to read a CSV file that has special characters in the headers. While I got what the documentation says about special characters in the body of the file, I couldn't get it to work for the column headers.

For example the file foobar.csv containing

cliché, foo
10,20


Can't be read by \DTLloaddb{foobar.csv}, though, presenting the following error message

Missing \endcsname inserted. \DTLloaddb{foobar}{foobar.csv}


While the same file exchanging cliché for cliche compiles flawlessly.

Thanks in advance for any help.

Minimum working example:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents*}{sample}
cliché
10
\end{filecontents*}
\usepackage{datatool}
\begin{document}
\DTLdisplaydb{sample}
\end{document}


Won't work with cliché, does work with cliche.

• Could you please provide a complete minimal working example, beginning at \documentclass and ending at \end{document}? For the csv you might use filecontents. May 10, 2017 at 17:07

Without specifying any <options>, both the header text and the key associated with that field/column is given the name in the header, and you can't have \cliché as the header key. So, specify a separate set of keys for the header:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{filecontents,datatool}

\begin{filecontents*}{foo.csv}
cliché, foo
10,20
\end{filecontents*}