Index: trunk/scripts/SyncEditorLayerIndex.java
===================================================================
--- trunk/scripts/SyncEditorLayerIndex.java	(revision 15879)
+++ trunk/scripts/SyncEditorLayerIndex.java	(revision 16098)
@@ -5,11 +5,12 @@
 
 import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
 import java.io.OutputStreamWriter;
+import java.io.Writer;
 import java.lang.reflect.Field;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -98,6 +99,5 @@
     private static String josmInputFile = "imagery_josm.imagery.xml";
     private static String ignoreInputFile = "imagery_josm.ignores.txt";
-    private static OutputStream outputFile;
-    private static OutputStreamWriter outputStream;
+    private static Writer outputStream;
     private static String optionOutput;
     private static boolean optionShorten;
@@ -132,12 +132,12 @@
         script.loadJosmEntries();
         if (optionJosmXml != null) {
-            try (OutputStreamWriter stream = new OutputStreamWriter(Files.newOutputStream(Paths.get(optionJosmXml)), UTF_8)) {
-                script.printentries(script.josmEntries, stream);
+            try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(optionJosmXml), UTF_8)) {
+                script.printentries(script.josmEntries, writer);
             }
         }
         script.loadELIEntries();
         if (optionEliXml != null) {
-            try (OutputStreamWriter stream = new OutputStreamWriter(Files.newOutputStream(Paths.get(optionEliXml)), UTF_8)) {
-                script.printentries(script.eliEntries, stream);
+            try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(optionEliXml), UTF_8)) {
+                script.printentries(script.eliEntries, writer);
             }
         }
@@ -147,7 +147,4 @@
         if (outputStream != null) {
             outputStream.close();
-        }
-        if (outputFile != null) {
-            outputFile.close();
         }
     }
@@ -216,6 +213,5 @@
 
         if (optionOutput != null && !"-".equals(optionOutput)) {
-            outputFile = Files.newOutputStream(Paths.get(optionOutput));
-            outputStream = new OutputStreamWriter(outputFile, optionEncoding != null ? optionEncoding : "UTF-8");
+            outputStream = Files.newBufferedWriter(Paths.get(optionOutput), optionEncoding != null ? Charset.forName(optionEncoding) : UTF_8);
         } else if (optionEncoding != null) {
             outputStream = new OutputStreamWriter(System.out, optionEncoding);
@@ -244,5 +240,5 @@
     void loadSkip() throws IOException {
         final Pattern pattern = Pattern.compile("^\\|\\| *(ELI|Ignore) *\\|\\| *\\{\\{\\{(.+)\\}\\}\\} *\\|\\|");
-        try (BufferedReader fr = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get(ignoreInputFile)), UTF_8))) {
+        try (BufferedReader fr = Files.newBufferedReader(Paths.get(ignoreInputFile), UTF_8)) {
             String line;
 
@@ -342,5 +338,5 @@
 
     void loadELIEntries() throws IOException {
-        try (JsonReader jr = Json.createReader(new InputStreamReader(Files.newInputStream(Paths.get(eliInputFile)), UTF_8))) {
+        try (JsonReader jr = Json.createReader(Files.newBufferedReader(Paths.get(eliInputFile), UTF_8))) {
             eliEntries = jr.readObject().getJsonArray("features");
         }
@@ -408,5 +404,5 @@
     }
 
-    void printentries(List<?> entries, OutputStreamWriter stream) throws IOException {
+    void printentries(List<?> entries, Writer stream) throws IOException {
         DecimalFormat df = new DecimalFormat("#.#######");
         df.setRoundingMode(java.math.RoundingMode.CEILING);
