I have my whole latex document which is encoded in latin-1. Also, the documentclass provided by my institution is designed to use latin-1. I write in french.

I wish to use .bib files created by Mendeley which are encoded in UTF-8. When I try to compile, latex gives me an error :

inputenc: Keyboard character used is undefined(inputenc) in inputencoding `latin1'.

Is there a way to convert the encoding on the fly with a simple command? Here is my setup :

Windows 7

MiKTeX 2.9

TexStudio 2.3

Mendeley to export my .bib

It's just a matter of changing the encoding since if I simply copy the content of the .bib file in a new file (with the right encoding setup in TexStudio), everything works fine. I don't want to do that since it breaks my workflow. I'm thinking of something like a command to add before the execution of pdflatex.

  • Incidentally, Texstudio is heavily based (to put it charitably) on Texmaker, so you may want to go to the source.
    – MatteoS
    Commented Aug 19, 2012 at 22:59
  • I want to use latin-1 because my documentclass seem to be designed with latin-1 in mind. latin-1 is loaded in the class.
    – jul059
    Commented Aug 19, 2012 at 23:47
  • @jul059: Latin1 is a subset of utf8. If you simply change inputenc, everything should work just as before. Or, could you clarify what you mean by "seem to be designed with Latin-1 in mind"? Commented Aug 20, 2012 at 7:57

3 Answers 3


You don't need to reencode your files. LaTeX is quite able to input an utf8 encoded file in ansinew/latin1 encoded main file:

\inputencoding{ansinew} %back to ansinew

But if you are using biblatex/biber you probably don't have to worry at all: If your bib-file contains only chars which are also covered by ansinew, then biber will convert the utf8 to ansinew when generating the bbl. This here works without problem for me: (the bib contains german umlauts.)


Btw: On windows you should normaly use ansinew instead of latin1 so that e.g. also the € is processed correctly.

  • 2
    Nice one: \usepackage[bibencoding=utf8]{biblatex}
    – MatteoS
    Commented Aug 20, 2012 at 9:34
  • Thanks, this is very nice. Is there a reason why I can't use this : \inputencoding{utf8} \bibliography{bibfile} \inputencoding{ansinew} I want to use bibtex and natbib since my institution's template was built with that system.
    – jul059
    Commented Aug 20, 2012 at 14:32
  • bibtex is an 8bit engine so it processes every file in 8-bit pieces. In utf8 non-ascii chars are longer than 8 bit so they are splitted by bibtex. This means that bibtex has problems to sort references with non-ascii chars correctly. It can also happen that bibtex inserts a line break in the middle of an utf8-char and then you will get errors. Commented Aug 20, 2012 at 14:49
  • combining the first with the second worked for me when using biblatex \inputencoding{ansinew} \printbibliography \inputencoding{utf8} (while bibencoding=utf8 did not)
    – embert
    Commented Nov 22, 2014 at 7:23

For this purpose I usually use a text editor like Sublime . It allows to load or save text files (or .tex files, of course) in the desired encoding.

The Latin1 encoding in Sublime uses the ISO/IEC name ISO 8859-1 .

Depending on your problem, you may want to use a LaTeX editor that automatically recognises font encodings, like Texmaker, for instance

  • Changing to Texmaker does not solve the problem, still the same error. It seems that even though the encoding is detected, It does not work since they are not all in the same encoding.
    – jul059
    Commented Aug 19, 2012 at 23:13

Since your whole workflow seems to be designed to work with Latin1, the question would then rather be how to get rid of UTF-8 in your workflow (even though it is quite sad to do so).

Then I think since .bib files are all the same, maybe you would want to just plain change your references manager to something that supports changing the output encoding and that still works for you (instead of changing the output encodings of your current manager, which seems not to be obvious).

For references managment, I use for myself JabRef. It is capable of changing the output encoding very easily and is quite easy to use as well as multi-platform.

Maybe this would be worth trying ?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .