From fd5cd64f20b7f7a343f54cc7ffd673d5138ce6cf Mon Sep 17 00:00:00 2001 From: Brian Quistorff Date: Fri, 5 Dec 2014 00:26:15 -0500 Subject: [PATCH 1/2] Fix encoding for DOI import Get the right encoding for the data from DOI import. Then, for convenience, also replace the en-dash so that most entries can compile under latex without modification. --- src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java b/src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java index 0c00fec7477..b84879d108c 100644 --- a/src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java +++ b/src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java @@ -119,7 +119,7 @@ public BibtexEntry getEntryFromDOI(String doi, OutputPrinter status) { String bibtexString; try { - bibtexString = Util.getResults(conn); + bibtexString = Util.getResultsWithEncoding(conn, "UTF8"); } catch (FileNotFoundException e) { if (status != null) { @@ -134,7 +134,9 @@ public BibtexEntry getEntryFromDOI(String doi, OutputPrinter status) { } - + //Usually includes an en-dash in the page range. Char is in cp1252 but not + // ISO 8859-1 (which is what latex expects). For convenience replace here. + bibtexString = bibtexString.replaceAll("(pages=\\{[0-9]+)\u2013([0-9]+\\})", "$1--$2"); BibtexEntry entry = BibtexParser.singleFromString(bibtexString); if (entry != null) { From a3521705d9515a8b16fc10b69daeb058fcd4efcb Mon Sep 17 00:00:00 2001 From: Brian Quistorff Date: Sun, 7 Dec 2014 16:02:05 -0500 Subject: [PATCH 2/2] +Contribution notes for DOI encoding fix --- CHANGELOG | 1 + src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java | 2 +- src/main/resources/help/About.html | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 6a02555832a..1d38a2a606e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ [master] + - Fix for bug 1213 (sourceforge): Fix encoding for DOI import - Feature #809: import pubmed central id (pmc) field from medline - Fix undoing Cleanup/Convert to Biblatex - Adapted pattern to parse DBLP entries diff --git a/src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java b/src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java index b84879d108c..f88f7bb7aac 100644 --- a/src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java +++ b/src/main/java/net/sf/jabref/imports/DOItoBibTeXFetcher.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 JabRef contributors. +/* Copyright (C) 2014 JabRef contributors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or diff --git a/src/main/resources/help/About.html b/src/main/resources/help/About.html index 03162d52027..5c1840ec082 100644 --- a/src/main/resources/help/About.html +++ b/src/main/resources/help/About.html @@ -83,6 +83,7 @@

Contributions from:

Alex Montgomery, Saverio Mori, Ambrogio Oliva, + Brian Quistorff, Stephan Rave, John Relph, Hannes Restel,