[Tex/LaTex] Utf8 character in citation keys

biberbiblatexbibtexunicode

This is my first post on tex.stackexchange, so Hello to everyone.

I am using biblatex with biber to produce the bibliography and I have a problem with utf8 characters. As usual, I can use utf8 characters in the fields, but they do not seem to work when used in the citation key. A mwe is the following:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french,english]{babel}
\usepackage{filecontents}

\begin{filecontents*}{bibliography.bib}
@article{rené,
    author = {Descartes, René},
    title = {Discourse on the method},
}
\end{filecontents*}

\usepackage[backend=biber]{biblatex}
\addbibresource{bibliography.bib}

\begin{document}
This citation fails\cite{rené}.
\printbibliography
\end{document}

I have specified the utf8 encoding but when I run biber (after two compilations with pdflatex) I get the following error:

INFO - This is Biber 2.7 (beta)
INFO - Logfile is 'mwe.blg'
INFO - Reading 'mwe.bcf'
INFO - Found 1 citekeys in bib section 0
INFO - Processing section 0
INFO - Looking for bibtex format file 'bibliography.bib' for section 0
INFO - Decoding LaTeX character macros into UTF-8
INFO - Found BibTeX data source 'bibliography.bib'
WARN - I didn't find a database entry for 'ren\IeC {\'e}' (section 0)
INFO - Overriding locale 'en-US' defaults 'variable = shifted' with 'variable = non-ignorable'
INFO - Overriding locale 'en-US' defaults 'normalization = NFD' with 'normalization = prenormalized'
INFO - Sorting list 'nty/global/' of type 'entry' with scheme 'nty' and locale 'en-US'
INFO - No sort tailoring available for locale 'en-US'
INFO - Writing 'mwe.bbl' with encoding 'UTF-8'
INFO - Output to mwe.bbl
INFO - WARNINGS: 1

As you can see, the character "é" in the command \cite{rené} has been expanded (by whom?), and therefore biber cannot find the corresponding citation key.

Is there a way to fix this? My keys are automatically generated periodically so I would prefer to avoid the manual editing of every non-ASCII character.

Best Answer

You can't use most UTF-8 in the entrykey when you use pdfLaTeX. If you use LuaLaTeX or XeLaTeX, which are both fully UTF-8 compatible out of the box, you can use most UTF-8 characters (amongst them é) in entrykey (some restrictions apply, but those are mostly in the ASCII-range: What is the difference between a biblatex literal and string?, Using BibTeX keys containing parentheses with Biber, What is valid as a BibLaTeX entry key?).

The Biber documentation clearly states

Handles UTF-8 citekeys and filenames (given a suitable fully UTF-8 compliant TeX engine)

but pdfLaTeX is not a Unicode engine. This has to do with how LaTeX internally handles citekeys and characters.

If you are creating the keys automatically, it should be possible to modify the processes such that you get ASCII only. But I find it is much better to come up with the citekeys yourself, that way they are easier to remember, because you already put some thinking into them.

Related Question