Index: applications/editors/josm/plugins/seachart/jrenderpgsql/src/jrenderpgsql/JrenderPgsql.java
===================================================================
--- applications/editors/josm/plugins/seachart/jrenderpgsql/src/jrenderpgsql/JrenderPgsql.java	(revision 36168)
+++ applications/editors/josm/plugins/seachart/jrenderpgsql/src/jrenderpgsql/JrenderPgsql.java	(revision 36169)
@@ -7,8 +7,9 @@
 import java.awt.geom.Point2D;
 import java.awt.image.BufferedImage;
-import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
 import java.io.StringReader;
 import java.io.ByteArrayOutputStream;
 import java.io.FileOutputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -396,5 +397,5 @@
         // library where it will be parsed again.
 
-        BufferedReader in = new BufferedReader(new StringReader(combinedBuf.toString()));
+        ByteArrayInputStream in = new ByteArrayInputStream(combinedBuf.toString().getBytes(StandardCharsets.UTF_8));
         map = new S57map(true);
         S57osm.OSMmap(in, map, false);
@@ -427,4 +428,12 @@
             public RuleSet ruleset() {
                 return RuleSet.SEAMARK;
+            }
+
+            public Chart chart() {
+              return null;
+            }
+
+            public int grid() {
+              return 0;
             }
         };
Index: applications/editors/josm/plugins/seachart/src/s57/S57osm.java
===================================================================
--- applications/editors/josm/plugins/seachart/src/s57/S57osm.java	(revision 36168)
+++ applications/editors/josm/plugins/seachart/src/s57/S57osm.java	(revision 36169)
@@ -3,4 +3,6 @@
 
 import java.io.File;
+import java.io.InputStream;
+import java.io.FileInputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -98,5 +100,19 @@
     }
 
-    public static void OSMmap(File in, S57map map, boolean bb) throws Exception {
+    public static void OSMmap(File file, S57map map, boolean bb) throws Exception {
+        try (InputStream in = new FileInputStream(file)) {
+          OSMmap(in, map, bb);
+        }
+    }
+
+    public static void OSMmap(InputStream in, S57map map, boolean bb) throws Exception {
+        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+        Document doc = dBuilder.parse(in);
+
+        OSMmap(doc, map, bb);
+    }
+
+    public static void OSMmap(Document doc, S57map map, boolean bb) throws Exception {
         double lat = 0;
         double lon = 0;
@@ -113,7 +129,4 @@
         map.nodes.put(4L, new Snode());
 
-        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-        Document doc = dBuilder.parse(in);
         doc.getDocumentElement().normalize();
         if (!doc.getDocumentElement().getNodeName().equals("osm")) {
