JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.59k stars 2.54k forks source link

Change file header #118

Closed koppor closed 9 years ago

koppor commented 9 years ago

Currently, JabRef adds following header to each BibTeX file

% This file was created with JabRef <version>
% Encoding: UTF8

If users use different versions of JabRef, this causes problems. Therefore, I propose to just remove the first header line.

I'm not sure about the second line. Should we guess the encoding from the file or keep the encoding information?

Other JabRef settings such as the group information or the save order is stored in BibTeX @comment entries. Maybe we should require the encoding also be stored as @comment? Possibly, this interferes with the parser and we have to first check existence of a encoding comment entry and then fire up the parser.

stefan-kolb commented 9 years ago
  1. The first line doesn't really add any benefit for the user so it could be removed. The only argument against it is that it is an implicit advertisment for our tool, so we could just change it to `Created with JabRef bibliography manager´ or alike.
  2. We should get the encoding of the file directly from the file header if possible.
koppor commented 9 years ago

As new user in the BibTeX world one might think that this line is important that JabRef can deal with it. Since all most pages about latex and bibtex recommend JabRef, I vote for completely dropping the line - even though some completely new users are not directly guided to JabRef.

mlep commented 9 years ago

Specifically for new users thinking such a line is important, I suggest to add % Go to <http://> and give money to JabRef ;-)

lenhard commented 9 years ago

I'll vote for dropping the line completely as well.

bluebirch commented 9 years ago

Add the first line as

-- coding: utf-8 --

which actually makes sense in many text editors.

mån 24 aug 2015 11:59 Jörg Lenhard notifications@github.com skrev:

I'll vote for dropping the line completely as well.

— Reply to this email directly or view it on GitHub https://github.com/JabRef/jabref/issues/118#issuecomment-134123566.

lenhard commented 9 years ago

Ok, @bluebirch has a point. We could just switch to a standard notation for specifying the encoding.

I don't really know what the most widely used notation for specifying the encoding is, so if no one objects, -*- coding: utf-8 -*- would be fine by me.

koppor commented 9 years ago

I don't know about Zotero and other bibtex managers.

@bluebirch Could you name some of the "many text editors"? Would be nice to have a justified decision as we don't want to change that line the next years. :grinning:

stefan-kolb commented 9 years ago

-*- coding: utf-8 -*- think this is only Emacs and Python. As far as I know there is no standard way of defining file encodings.

bluebirch commented 9 years ago

You might be right. As a former Emacs user, I see the world differently. But I'm slowly adapting to a new reality with Sublime Text. ;-)

stefan-kolb commented 9 years ago

See also http://stackoverflow.com/questions/90838/how-can-i-detect-the-encoding-codepage-of-a-text-file

koppor commented 9 years ago

I really like some auto-detection, which frees the user to configure its programs.

koppor commented 9 years ago

We can also go for supporting UTF-8 only to have the .bib file really portable across different systems. Other encodings can be converted to UTF-8 by JabRef while loading.

matthiasgeiger commented 9 years ago

Just stumbled over this - However, I don't have the time to dig deeper in the matter, but the first line seems to have some purpose ;-)

stefan-kolb commented 9 years ago

Yes there is still one migration based on the JabRef version. We can remove the file header though. We just need to keep the logic for parsing the old header possibly... See FileLinksUpgradeWarning.java

stefan-kolb commented 9 years ago

This commit 4558fb644330b5dc0120332979fd7871420be049 removes the JabRef version file header. We need to come up with a good solution for the encoding though. Backwards compatibility is tested and retained in this commit. We could remove quite some code if this can be made obsolete.

lenhard commented 9 years ago

The encoding name is now written as "UTF-8", see also #155 The old "UTF8" is automatically overwritten when the file is saved.

lenhard commented 9 years ago

How about settling with the current status quo for now:

% Encoding: UTF-8

and closing this issue? Any objections?

koppor commented 9 years ago

Fine with me. The other encoding strings are not convincing.

matthiasgeiger commented 9 years ago

:+1: