# How to save .bib file in latin1 encoding and avoid problems with special characters?

I have added a lot of new references to my .bib file, which I got from online portals like sciencedirect.com.

I'm managing my .bib file with JabRef 2.10.

My bib file was encoded in latin1 (CP1252), because that worked well with my latex setup.

No with the new references I could not save my file any more because the encoding CP1252 can not display the following characters

I then tried to save it in UTF8, which for sure worked well, but produced a lot of problems with my latex setup: if I understood correctly, I then have to use biber as biblatex backend and I had endless problems with compiling and was not able to get a working pdf file in the end. :-(

I even tried to change all my .tex files to utf8 as well to match them with the .bib files, but still I get errors with biber. (One idea: I have some fields "annotate" with very much text in there, which might cause problems.)

So I want my CP1252 encoding back but I don't know how to find the problematic characters in my .bib file and replace them by something which CP1252 can process.

### Question:

How can I identify the records with the problematic characters and replace those? The bibtex file is very large (thousands of entries) and I don't see how to solve that, I've already lost hours of my (very short) time and don't see any hope.

• Before anything, backup all your files. – Sigur Feb 20 '15 at 19:39
• Biber is so great, it also provides the solution to this problem. Try: biber --tool --output_encoding=ascii mybib.bib (or latin1 or cp1252 or...; and where 'mybib.bib' is your actual .bib file). If there's a lesson here, it might well be that you should consider investing more effort into getting biblatex and biber up and running! Note that you may need to specify the input encoding too in your case: it is unclear what encoding your bibliography file now has. – jon Feb 20 '15 at 20:32
• Is that a corrupted cache issue? Try biber --cache to see if the folders match. Is so, try removing it with the command rm -rf biber --cache. – jon Feb 20 '15 at 20:53
• Imho the best way is: convert everything to utf8 (or find someone who does it for you). This is better than trying to force things back to an 8-bit encoding. – Ulrike Fischer Feb 20 '15 at 21:45
• @Martin: Imho you are rushing and so run into problems. Your starting problems with the chars could have been easily solved by using commands like \infty, but you jumped with your whole thesis into utf8 and biber. It is easy (and doesn't take more than 1-2 hours even with a large document) to move everything to utf8 and biber - but not if one tries to do it in one go without knowledge. Do it in small steps. If you want to try out biber + utf8: start with a small test document and add your bib in small pieces. – Ulrike Fischer Feb 21 '15 at 11:50

## 1 Answer

Thanks to @jon for the hint:

It can be done with biber with the following command:

biber --tool --output_encoding=cp1252 mybib.bib


I got an error message first:

read_file '/var/folders/FX/FXr0KhAz2RWkK++BYv0W1++++TU/-Tmp-/par-6d626734/cache-a3cdad9231‌​6c60c9c5179d80d6bb51a7a024393c/inc/lib/Biber/biber-tool.conf' - sysopen: No such file or directory at /var/folders/FX/FXr0KhAz2RWkK++BYv0W1++++TU/-Tmp-/par-6d626734/cache-a3cdad92316‌​c60c9c5179d80d6bb51a7a024393c/inc/lib/Biber/Config.pm line 341.


the solution was to clean the biber cache:

rm -rf biber --cache