From 8d5869e0ecaa3ad78098918dd84c5f54dc005d32 Mon Sep 17 00:00:00 2001 From: Joseje Sinohui Date: Tue, 24 Dec 2019 12:54:01 -0700 Subject: [PATCH 1/3] Adds call to LatexToUnicodeAdapter.format() to CSLAdapter Adds extra map to the string data to handle diacritics --- src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java b/src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java index 726980671f2..e5dbecafa2b 100644 --- a/src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java +++ b/src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java @@ -18,6 +18,7 @@ import de.undercouch.citeproc.bibtex.BibTeXConverter; import de.undercouch.citeproc.csl.CSLItemData; import de.undercouch.citeproc.output.Bibliography; +import org.jabref.model.strings.LatexToUnicodeAdapter; import org.jbibtex.BibTeXEntry; import org.jbibtex.DigitStringValue; import org.jbibtex.Key; @@ -97,6 +98,7 @@ private static CSLItemData bibEntryToCSLItemData(BibEntry bibEntry) { for (Field key : bibEntry.getFieldMap().keySet()) { bibEntry.getField(key) .map(removeNewlinesFormatter::format) + .map(LatexToUnicodeAdapter::format) .map(latexToHtmlConverter::format) .ifPresent(value -> { if (StandardField.MONTH.equals(key)) { From 72ae9da7736971994fcf9459c80f2ef82a0665ce Mon Sep 17 00:00:00 2001 From: Joseje Sinohui Date: Tue, 24 Dec 2019 13:13:47 -0700 Subject: [PATCH 2/3] Adds test to check if latex2unicode is working properly --- .../citationstyle/CitationStyleGeneratorTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/java/org/jabref/logic/citationstyle/CitationStyleGeneratorTest.java b/src/test/java/org/jabref/logic/citationstyle/CitationStyleGeneratorTest.java index b8279234a0b..ecb7a1d6b37 100644 --- a/src/test/java/org/jabref/logic/citationstyle/CitationStyleGeneratorTest.java +++ b/src/test/java/org/jabref/logic/citationstyle/CitationStyleGeneratorTest.java @@ -117,4 +117,17 @@ void testXslFoFormat() { String actualCitation = CitationStyleGenerator.generateCitation(entry, style, format); assertEquals(expectedCitation, actualCitation); } + + @Test + void testHandleDiacritics() { + BibEntry entry = new BibEntry(); + entry.setField(StandardField.AUTHOR, "L{\"a}st, First and Doe, Jane"); + // if the default citation style changes this has to be modified. + // in this case ä was added to check if it is formatted appropriately + String expected = "
\n" + + "
[1]
F. Läst and J. Doe, .
\n" + + "
\n"; + String citation = CitationStyleGenerator.generateCitation(entry, CitationStyle.getDefault()); + assertEquals(expected, citation); + } } From d4f60b2b573fb245a9a20a555f021157cbd21bd3 Mon Sep 17 00:00:00 2001 From: Joseje Sinohui Date: Tue, 24 Dec 2019 13:16:47 -0700 Subject: [PATCH 3/3] Update CHANGELOG.md with fix for unicode characters --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 044b4edc5d9..1c3f7a0351f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an issue where the Medline fetcher was only working when JabRef was running from source [#5645](https://github.com/JabRef/jabref/issues/5645) - We fixed some visual issues in the dark theme [#5764](https://github.com/JabRef/jabref/pull/5764) [#5753](https://github.com/JabRef/jabref/issues/5753) +- We fixed an issue where non-default previews didn't handle unicode characters. [#5779](https://github.com/JabRef/jabref/issues/5779) + ### Removed