# Accented characters and inputenc settings

In my bibliography database, there are several references where authors have accented characters in their names, e.g. Chagn\'e. The inputenc package seems to have a problem with this. My setting is:

\usepackage[latin9]{inputenc}


This generates error referring to the particular line number in my .bib database. The error is repeated dozens of times before the final PDF is generated. Can someone recommend what setting I should use for inputenc?

Here is an example from the bib file:

@article{Chagne2003a,
author = {Chagn\'e, David and Brown, Garth and Lalanne, C\'eline and Madur, Delphine and Pot, David and Neale, David and Plomion, Christophe},
title = {Comparative genome and QTL mapping between maritime and loblolly pines},
journal = {Molecular Breeding},
pages = {185--195},
volume = {12},
issue = {3},
url = {http://dx.doi.org/10.1023/A:1026318327911},
year = {2003}
}


The reference as well as the citation is printed correctly in the PDF. However, during compilation, an error is generated at least 6 times which requires user intervention.

Edit#2 - My bibliography package is 'Biblatex' which accesses the .bib file directly. The errors are generated during compilation. I will paste it here.

   l.132

?

! Package inputenc Error: Keyboard character used is undefined
(inputenc)                in inputencoding latin9'.

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

l.132

?


Line number 132 is where the reference in question is in the bib database.

Edit # 3

Here is something strange. I removed the accent settings from the .bib file. Thus Chagn\'e is now Chagne. Then I deleted all aux, .bbl and .blg files from the compilation folder. I am still getting the exact same errors. Now I am not so sure if 1.132 refers to line #132 in the .bib.

Edit # 4 -- A minimal example:

\documentclass[12pt]{article}
\usepackage[bibstyle=authoryear,
citestyle=authoryear,
natbib=true]{biblatex}
\usepackage{filecontents}
\usepackage[latin9]{inputenc}

\begin{filecontents}{genetics.bib}
@article{Chagne2003a,
author = {Chagn\'{e}, David and Brown, Garth and Lalanne, C\'{e}line and Madur, Delphine and Pot, David and Neale, David and Plomion, Christophe},
title = {Comparative genome and QTL mapping between maritime and loblolly pines},
journal = {Molecular Breeding},
pages = {185--195},
volume = {12},
number = {3},
doi = {10.1023/A:1026318327911},
year = {2003}
}
\end{filecontents}

\begin{document}
\section{Introduction}
This was first reported by \citet{Chagne2003a}.

\printbibliography

\end{document}

-
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}, and an exemlary .bib file/entry. – doncherry Jan 29 '13 at 4:40
It's surprising that Chagn\'e is giving problems, as it uses only seven bit ASCII, which is independent on the input encoding. Error messages by LaTeX never refer to lines in the .bib file. – egreg Jan 29 '13 at 8:08
@cryptic0 As I've already said, LaTeX never reads the .bib file. If you're on a Unix systems, try running pdflatex with the -file-line-error command line option and you'll see more clearly what's the file involved. – egreg Jan 29 '13 at 18:09
@cryptic0 Please, try making up a minimal example. – egreg Jan 29 '13 at 18:34

Disclaimer: This answer has no nice pictures, sorry.

So, to sum up the conversation held in the question's comments, and to provide some additional explanations:

• The error was caused by inputenc, which complains about some character found at line 132 of main.tex.
• At that line there is only the command \printbibliography, implemented in package biblatex.
• So the offending char must be in the expansion of the macro \printbibliography but it is very difficult to find where that character came from.

Some diagnosis tools:

• iconv program can convert from one encoding to another. If it finds some invalid character while converting, it stops and outputs an error about the offending char, showing the line number and the column number in that line where the char was found.
• So we can run iconv on main.tex and on the .bib file, asking it to convert from latin9 to any other encoding which is a superset of latin9 (such as utf8), and see if it finds some char not in latin9. The command could be:

iconv -f latin-9 -t utf-8 < main.tex > /dev/null


Note that iconv reads from standard input (which is redirected from main.tex) and writes the result of the conversion in the standard output (which we redirect to /dev/null since we are not really interested in the output, but in possible errors). If an error is found, it will be output to the standard error, which is not redirected, so it will show up in the terminal.

• The above test did not produce any output, so no errors were found.

At this point there is two possibilities:

1. We still did not run the test on the file which contains the invalid latin9 char. Perhaps it is in some auxiliar file which is read by \printbibliography.
2. Perhaps latin9 definition file for inputenc is incomplete, and the allegedly offending char is indeed a valid char, only that inputenc doesn't know about it.

In order to validate 1., the iconv test should be run in all the files which are input while compiling main.tex. It can be a bit difficult to tell which are all of them.

In any case, removing the line \usepackage[latin9]{inputenc} will make the error message dissapear, so it is an appealing "solution", but note that suppressing the symptoms is not a way for healing a disease. What if there is an invalid char after all?

Well, in absence of inputenc package, TeX is configured to ignore all non-ascii char, so if there is any latin9 character (valid or invalid) it will be silently suppressed in the output. So the worst you can expect is some char missing here and there. This can be difficult to spot, so to be in the safe side I will continue with the iconv tests.

Some final notes:

• When you input accented chars using standard TeX accent macros, such as \'e you are using only ASCII chars in the input, so no inputenc package is required. This is required only if you want to enter accented chars "directly" (i.e: é).
• If you can input directly é, you need to be sure about which encoding your editor uses to save the file. Most common encodings for european languages (french, spanish, italian, and others) are ISO-8859-1 (also known as latin1), ISO-8859-15 (also known as latin9) and utf8. The last one is indeed a way of coding the whole Unicode charset, so all alphabets are covered.
• With respect to accented vowels, both latin1 and latin9 use the same codes, so you can give any of them as option for inputenc. The main difference between these encodings is that latin9 has a code for the euro sign (€) while latin1 does not.

I would do an additional test, just out of curiosity. Bring back inputenc package, but use latin1 instead of latin9. If there is some kind of bug in latin9 implementation, perhaps the bug is not present in latin1, and (unless you need the euro sign or other rare characters such as Š, š, Ž, ž, Œ, œ, or Ÿ, there will be no difference at all.

-

The recommendation here is to always use {\' e} and such (i.e., {, \command, <stuff> }) for non-ASCII characters in bibliographies. BIBTeX considers everything except the letter (or <stuff>) in such constructions as an accent, and ignores it for sorting and such.

-

Use {\' e} and such, it's the safest route.

===========

But in the interest of investigating the issue, I've tested putting latin1 instead of latin9 in the inputenc package, and same errors popped up

I've tested utf8, and lo and behold, more information popped up:

package inputenc error: Unicode char \u8:Â not set up for use with latex


And this tells me there are spurious Â characters in my .bib file, which there are (damn copy-paste from IEEE websites)!

But also:

package inputenc error: Unicode char \u8:Â€ not set up for use with latex


and

package inputenc error: Unicode char \u8:Â´´ not set up for use with latex


which, by trial and error I've determined, are caused by the following line

booktitle={Computer Vision ECCV 2012. Workshops and Demonstrations},
`
-