JabRef / jabref

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

Write XMP to PDF fails to match citation keys with special characters #7925

Open Marathon2112 opened 3 years ago

Marathon2112 commented 3 years ago

The feature added in #7814 works pretty well, except when the citation keys include special unicode character (e.g. the sharp s in Weiß_2018). In these cases, JabRef returns "Cannot find [...] in library."

Opening the '.bib' library in a standard text editor shows that the unicode character is saved correctly into the database.

JabRef 5.3--ArchLinux--1 Linux 5.12.15-arch1-1 amd64 Java 16.0.1 JavaFX 16+8

koppor commented 3 years ago

The whole XMP handling should be improved. That is written down at https://github.com/koppor/jabref/issues/337.

addak commented 2 years ago

Hi I've started looking into this... So yeah I tried this rather naively

        BibEntry bibEntry = new BibEntry(StandardEntryType.Article);
        bibEntry.setCitationKey("Weiß_2018");
        BibDatabase db = new BibDatabase(List.of(bibEntry));
        Assertions.assertNotNull(db.getEntryByCitationKey("Weiß_2018").get());

And it works fine. so yeah, any idea how I can go about debugging the flow from cli input? O I could add temp logs, build and deploy the exe, and see how it works but I'm not sure how to go about that either

Edit : Okay I think by running in debug mode, putting a debug point in argumentProcessor and adding program arguments in run config, I can debug it.... Would it be possible to provide the args/ relevant data to re-create the scenario? Thanks!

Edit 2 : Not sure if I'm missing something, but I'm unable to re-create it... image

These are the args I used : --writeMetadatatoPdf Weiß_2018 .\src\test\resources\org\jabref\logic\xmp\article_dublinCore.bib

@Siedlerchr maybe this issue doesn't occur anymore with the latest version of jabref?

Siedlerchr commented 2 years ago

@addak If you cannot reproduce it anylonger it's good!

koppor commented 2 years ago

It would be great if you could submit a pull request adding a test case. The class to touch seems to be https://github.com/JabRef/jabref/blob/main/src%2Ftest%2Fjava%2Forg%2Fjabref%2Flogic%2Fxmp%2FXmpUtilWriterTest.java.

koppor commented 1 year ago

The test case should include passing command line parameters to JabRef. Maybe even a new GitHub workflow needs to be generated.

@Marathon2112 Could you share your complete command line? I would assume something like

jabref -w Weiß_2018 test.bib
Marathon2112 commented 1 year ago

That would be the command line to use (when writing this bug report, I was using the GUI feature however).

When I do run this command, I get the following error:

File Weiß_2018 is not linked to any entry in database.

I can confirm that the file is linked in the database, despite the error message.

koppor commented 1 year ago

We cannot reproduce using the GUI.

grafik

We click on "Write XMP Metadata to PDF" - and get that it is successfully written:

grafik

koppor commented 1 year ago

I put it into "Reserved" until the issue is reproducible easily.

koppor commented 11 months ago

I think, this is a linux issue - I assume that there is no special file system involved.

To reproduce:

  1. Install ArchLinux
  2. Install JabRef from source following the getting started guide
  3. Create a PDF file Weiß.pdf (rename https://github.com/JabRef/jabref/blob/main/src/test/resources/org/jabref/logic/importer/fileformat/LNCS-minimal.pdf to Weiß.pdf)
  4. Create a test entry (maybe @Article)
  5. Link the file to the article (drag an drop?)
  6. Click on "Write XMP data" in the file field.

If that shows the error, write a test case doing that. You can check in Weiß.pdf in the repository.