How to correctly export accented characters in bib file?

edited April 5, 2022
I'm using Zotero to compile my bibliography and TexStudio to write my report in Latex.

My procedure is:
1. Select all references
2. Right-click, select 'Export items...' menu option
3. Then 'Format: BibTex, Character Encoding: Unicode (UTF-8)', then 'Ok'

This produces the .bib file.

However, when I generate the bibliography in TexStudio I get errors like:

Package inputenc Error: Invalid UTF-8 byte sequence. ...illar, R.~d., Hodouin, D., and Poulin, �.

This is due to the following text in Zotero and in the .bib file:

author = {Desbiens, A. and Nunez, E. and Villar, R. del and Hodouin, D. and Poulin, É.},

which is the text straight from Zotero for this item.

This is then translated to this text in the .bbl file:

\bibitem[Desbiens et~al., 2008]{desbiens_using_2008}
Desbiens, A., Nunez, E., Villar, R.~d., Hodouin, D., and Poulin, Ã. (2008).
\newblock Using {Process} {Control} to {Increase} the {Energy} {Efficiency} of
{Mineral} and {Metal} {Processing} {Plants}.
\newblock {\em International Journal of Power and Energy Systems}, 28(2).

Note the 'Ã' character here.

I can fix this problem by MANUALLY changing the contents of the bib file to:

Poulin, {\'E}}

But I want to know what I'm doing wrong. Am I using the wrong text encoding, is it even a problem in Zotero export or in fact a problem in TexStudio bibtex compilation?
  • Short version: Either change.the encoding on export or use \usepackage[utf8]{inputenc} in the LaTeX preamble
  • Thanks. But it looks like the template I am using already uses UTF-8. I found this in the main file's headers:

    %% Encodage utilisé pour les caractères accentués dans les fichiers
    %% source du document. Les gabarits sont encodés en UTF-8. Inutile
    %% avec XeLaTeX, qui gère Unicode nativement.
    \ifxetex\else \usepackage[utf8]{inputenc} \fi

    The comment roughly translates to:
    "Encoding used for accented characters in document source files. Templates are encoded in UTF-8. Useless with XeLaTeX, which supports Unicode natively."

    I tried replacing this with \usepackage[utf8]{inputenc} and it didn't solve the problem.

    So, as you suggested, I also tried changing the character encoding when exporting to 'Western' and now it works. The bib file contents now look like this:

    author = {Desbiens, A. and Nunez, E. and Villar, R. del and Hodouin, D. and Poulin, {\'E}.},

    thanks.
  • If you are writing with BibTeX, you should install and use the BetterBibTeX plugin. With this, you can also export the bib file converting those characters into TeX escapes
Sign In or Register to comment.