5

I received this message when I try to include my bibliography in the document with \printbibliography

! Package inputenc Error: Unicode char \u8:‐ not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.174 ...rintbibliography[heading=subbibliography] 

I would say the problem is with some character in my .bib file. But if I receive no error message from Biber how do I locate the problematic character?

7
  • At the very least, the .pdf or .dvi of that subbibliography will likely show some funky characters; and it will probably not be in an entry that contains simple, unaccented characters of the Latin alphabet, but something with accents or from other character sets. Commented Feb 20, 2014 at 6:59
  • @jon it is a very long pdf. Is there anyway to add something like --verbose to LaTeX and then get the problem? Commented Feb 20, 2014 at 7:06
  • It could also be something existent in the bib file, but is not printed to the pdf. Making a miinimal working example will definitely get you to the error, but it might take a while. Commented Feb 20, 2014 at 7:13
  • 3
    The problematic character is (U+2010 HYPHEN) as the error states. Simply make a search with your editor for that character in your .bib file. Commented Feb 20, 2014 at 7:28
  • @karlkoeller That worked. Commented Feb 20, 2014 at 8:23

3 Answers 3

8

This kind of problem can be easily resolved.

The package inputenc shows an error that gives you information about the problematic character in your document. In your case it is (U+2010 HYPHEN), and the problematic line is \printbibliography[heading=subbibliography], which means that such character is in your .bib file.

Using the "search and replace" feature of your editor, substitute that character with one recognised by inputenc, e.g. - (U+002D HYPHEN-MINUS) and the problem is solved.

A good editor is usually able to show the Unicode code of the character. If yours is not and you want to know that code, you can find lots of tools in the web for this purpose.

An example is Unicode Character Finder. Paste the character there, and you will get all the needed information on it.

enter image description here

1

For me the problem was not an invalid character in the .bib file -- it was an invalid character in the .bbl file generated by biber!

Specifically, my .bib file listed an author named Beno\^{\i}t, which biber turned into Benoît, and apparently inputenc choked on that. I found the solution in the biblatex manual: simply pass safeinputenc to biblatex, e.g.

\usepackage[backend=biber, safeinputenc]{biblatex} 

and you are (I was) good to go.

2
  • Constructions with a dotless i are particularly tricky (cf. tex.stackexchange.com/q/251261/35864, github.com/plk/biber/issues/65). If you input Benoît as Beno{\^i}t (that's how BibTeX likes it) or Benoît (preferred with Biber) things will work even without safeinputenc. Biber (or rather LaTeX) usually only chokes if you use the dotless \i and a combining accent. Commented May 7, 2024 at 15:22
  • Indeed, changing the file to Beno{\^i}t fixes the issue without requiring safeinputenc. The corresponding .bbl file encodes î as U+00EE. Commented May 8, 2024 at 14:24
0

A very similar problem was solved in this question: https://stackoverflow.com/questions/13596531/how-to-search-for-non-ascii-characters-with-bash-tools

Look at the answer suggesting

nonascii() { LANG=C grep --color=always '[^ -~]\+'; } 

You will be able to see all problematic characters in red and you can add additional grep lines. For example you can ignore UTF-8 in Author, but print it in Pages fields.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.