"% Encoding: UTF-8" not in bib file

I’m currently wondering why my bibfile (if opened in editor or notepad++) leaves the first line “% Encoding: UTF-8” out and just starts with listing the contents?
Under Library → Library properties → General → Library encoding I use UTF-8.

But if I adjust to UTF-16, the bib file said “% Encoding: UTF-16” in the first line.

I’ll need this first line of “% Encoding: UTF-8” when using my bib file in other programs and I wonder, what I’m doing wrong.

Many thanks already!

PS.: I know I could just add this line manually but I’d just like to know if there’s a simple reason for my problem which I could easily avoid.


JabRef always tries to read and autodetect the used encoding and save the file with UTF-8 by default. The encoding line is only written when you specify a different encoding than UTF-8.
This was a change in recent versions

cc @koppor

1 Like

Thank you for reporting this to us!

In the year 2018, pdflatex decided to switch the default input encoding to UTF-8 (see https://tug.org/TUGboat/tb39-1/tb121ltnews28.pdf). Thus, it is not necessary to explicitly define any input encoding (inputenc).

To be in line with that development, we decided in 2021 to default to UTF-8 (and not to write the UTF-8 header, because it’s the default). Details: Add encoding detection (and pin export to UTF-8) by koppor · Pull Request #8506 · JabRef/jabref · GitHub

We did not see that some other tools might rely on that encoding header (Thank you for the hint).

Maybe, you could name us these tools so that we get an indication of the usage of that property.

We changed the latest JabRef developer version to write the encoding header again (if it is present in the .bib file).

Thus, to keep your .bib file working again (for your use case):

  1. Update to the latest developer build (index - powered by h5ai v0.29.0 (https://larsjung.de/h5ai/))
  2. Add % Encoding: UTF-8 manually to your .bib file

Please report back to us if it works for you!

1 Like