jabref icon indicating copy to clipboard operation
jabref copied to clipboard

convert LaTeX symbols in entries before further actions (non UTF-8)

Open wwtan opened this issue 5 years ago • 3 comments

JabRef version 5.3--2021-02-16--5546141 on Windows 10.

  • [x] Mandatory: I have tested the latest development version from http://builds.jabref.org/master/ and the problem persists

Steps to reproduce the behavior:

  1. Create the following bib file:
    % Encoding: UTF-8
    @Article{testItem,
      author = {A{\"{u}\"{o}}{\'{e}}{\"{a}\"{o}\"{u}}, mustermann},
      title  = {{non-utf8 chars like these {\"{u}}{\"{o}}{\'{e}}}},
      year   = {2015},
      file   = {:/Users/wtan/some {\&} title with non-ascii-non-utf8 chars like these {\"{u}}{\"{o}}{\'{e}}.pdf:PDF},
      url    = {https://github.com/wwtan/Test{\_}a},
    }
    
    @Article{testItem,
      author = {A{\"{u}\"{o}}{\'{e}}{\"{a}\"{o}\"{u}}, mustermann},
      title  = {{Proper UTF8 chars like these üöé}},
      year   = {2015},
      file   = {:/Users/wtan/some & title with non-ascii-non-utf8 chars like these üöé.pdf:PDF},
      url    = {https://github.com/wwtan/Test_a},
    }
    
    @Comment{jabref-meta: databaseType:bibtex;}
    
  2. For simplicity, let's focus on URL first. The correct URL should be https://github.com/wwtan/Test_a . The preview of first item is alright: However, when I click on Open button besides the URL field, it directs to https://github.com/wwtan/Test%7B/_%7Da instead. The second item works just fine.
  3. Create/copy a pdf file name some & title with non-ascii-non-utf8 chars like these üöé.pdf and change the folder names (only, not the file name) in the given bib accordingly. The second item can open the file directly from JabRef, but not the first one. In fact, error will be thrown due to illegal char.
  4. In short, the LaTeX/bibTeX non-UTF8 chars are not handled before opening links/file, which results in such error.

I could not find anything online yet to convert my bibliography to use UTF8, hence opening an issue here. I am aware that this may be treated as bug or feature request depending on how you draw the line.

Thanks and best wishes.

wwtan avatar Feb 20 '21 19:02 wwtan

We cannot convert file and url paths from latex to unicode automatically, since they might contain the backlash as a valid path segment separator, e.g. C:\mathbb is a valid path, and not a latex command.

So the question would be, how did you end up with having latex-encoded strings in the file and url field. Maybe we can improve something so that this doesn't occur in the first place.

tobiasdiez avatar Feb 21 '21 10:02 tobiasdiez

I was using Mendeley previously to auto-generate .bib file. So I doubt if there is anything we can do about it.

Just realised my mistake: I thought that perhaps in bib, only those enclosed with extra {} will be interpreted for LaTeX symbol ({\"o} will become ö but \"o wouldn't and would still be \"o). Obviously, I was wrong about it.

wwtan avatar Feb 21 '21 12:02 wwtan

Ok, then it indeed sounds like an export problem of Mendeley. You can try to export the mendely library in another format, and then import this (we have import options for RIS and Endnote as well).

tobiasdiez avatar Feb 21 '21 12:02 tobiasdiez