Commit e2875ae0 authored by Niels Erik G. Nielsen's avatar Niels Erik G. Nielsen
Browse files

Always convert binary MARC to UTF-8

   - using MARC4J's MarcPermissiveStreamReader,
     with the `permissive` option set to true.
parent ddb873ec
* Always convert MARC binary to UTF-8.
* Workarounds to deal with FTP server timeouts for large files. PR-818.
## 2.14.0
......@@ -21,12 +21,7 @@ import javax.xml.transform.dom.DOMResult;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.marc4j.MarcException;
import org.marc4j.MarcStreamReader;
import org.marc4j.MarcStreamWriter;
import org.marc4j.MarcWriter;
import org.marc4j.MarcXmlWriter;
import org.marc4j.TurboMarcXmlWriter;
import org.marc4j.*;
import org.xml.sax.SAXException;
import com.indexdata.masterkey.localindices.client.filefilters.CompositeEntryFilter;
......@@ -505,9 +500,7 @@ public class XmlMarcClient extends AbstractHarvestClient {
private void storeMarc(InputStream input, String encoding) throws
IOException {
//encoding defaults to MARC-8 when null
MarcStreamReader reader = new MarcStreamReader(input, encoding);
MarcPermissiveStreamReader reader = new MarcPermissiveStreamReader(input,true, true);
boolean isTurboMarc = false;
//check what MARC output we want
MimeTypeCharSet mimeType =
......@@ -12,10 +12,7 @@ import javax.xml.parsers.ParserConfigurationException;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.marc4j.MarcXmlWriter;
import org.marc4j.MarcReader;
import org.marc4j.MarcStreamReader;
import org.marc4j.MarcWriter;
import org.marc4j.*;
import org.marc4j.marc.Record;
import org.xml.sax.SAXException;
......@@ -26,7 +23,7 @@ public class MarcToJson {
throws UnsupportedEncodingException, SAXException, IOException,
ParserConfigurationException {
List<JSONObject> jsonList = new ArrayList<>();
MarcReader reader = new MarcStreamReader(inputStream);
MarcReader reader = new MarcPermissiveStreamReader(inputStream, true, true);
while(reader.hasNext()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Record record =;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment