Changeset 5749 in josm


Ignore:
Timestamp:
2013-03-02T00:51:28+01:00 (12 years ago)
Author:
Don-vip
Message:

fix #8473 - Export GeoJSON as UTF-8 (patch by oschrenk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/GeoJSONExporter.java

    r5361 r5749  
    22package org.openstreetmap.josm.io;
    33
     4import static org.openstreetmap.josm.tools.I18n.tr;
     5
     6import java.io.BufferedWriter;
    47import java.io.File;
    5 import java.io.FileWriter;
     8import java.io.FileOutputStream;
    69import java.io.IOException;
     10import java.io.OutputStreamWriter;
     11import java.io.Writer;
     12
    713import org.openstreetmap.josm.actions.ExtensionFileFilter;
    814import org.openstreetmap.josm.gui.layer.Layer;
    915import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    10 import static org.openstreetmap.josm.tools.I18n.tr;
    1116
    1217public class GeoJSONExporter extends FileExporter {
     
    2328        if (layer instanceof OsmDataLayer) {
    2429            String json = new GeoJSONWriter((OsmDataLayer) layer).write();
    25             FileWriter out = new FileWriter(file);
    26             out.write(json);
    27             out.close();
     30            Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
     31            try {
     32                out.write(json);
     33            } finally {
     34                out.close();
     35            }
    2836        } else {
    2937            throw new IllegalArgumentException(tr("Layer ''{0}'' not supported", layer.getClass().toString()));
Note: See TracChangeset for help on using the changeset viewer.