Handles varying types of bib file encodings

This pull request addresses issue #335

The added code reads the first 32 bytes of a bib file and checks if it can determine the encoding of a file. If so it sets the encoding to the determined encoding. If it is not able to determine the encoding it uses UTF-8 as a default value.

It fixes issue #335 for the following encodings:

* UTF-8 with BOM
* UTF-16-LE with BOM
* UTF-16-BE with BOM