Changeset 3372 in josm


Ignore:
Timestamp:
2010-07-09T13:38:41+02:00 (14 years ago)
Author:
bastiK
Message:

fixed #5226 - XML encodings and byte-order marker (BOM) support

Location:
trunk/src/org/openstreetmap/josm/io
Files:
1 added
3 edited

Legend:

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

    r3083 r3372  
    3737                is = new FileInputStream(file);
    3838            }
    39             // Workaround for SAX BOM bug
    40             // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206835
    41             if (!((is.read() == 0xef) && (is.read() == 0xbb) && (is.read() == 0xbf))) {
    42                 is.close();
    43                 if (file.getName().endsWith(".gpx.gz")) {
    44                     is = new GZIPInputStream(new FileInputStream(file));
    45                 } else {
    46                     is = new FileInputStream(file);
    47                 }
    48             }
    4939            final GpxReader r = new GpxReader(is);
    5040            final boolean parsedProperly = r.parse(true);
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r2907 r3372  
    355355     */
    356356    public GpxReader(InputStream source) throws IOException {
    357         this.inputSource = new InputSource(new InputStreamReader(source, "UTF-8"));
     357        this.inputSource = new InputSource(UTFInputStreamReader.create(source, "UTF-8"));
    358358    }
    359359
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r3226 r3372  
     1// License: GPL. See LICENSE file for details.
    12package org.openstreetmap.josm.io;
    23
     
    45
    56import java.io.InputStream;
    6 import java.io.InputStreamReader;
    77import java.text.MessageFormat;
    88import java.util.ArrayList;
     
    570570            progressMonitor.beginTask(tr("Prepare OSM data...", 2));
    571571            progressMonitor.indeterminateSubTask(tr("Parsing OSM data..."));
    572             InputSource inputSource = new InputSource(new InputStreamReader(source, "UTF-8"));
     572
     573            InputSource inputSource = new InputSource(UTFInputStreamReader.create(source, "UTF-8"));
    573574            SAXParserFactory.newInstance().newSAXParser().parse(inputSource, reader.new Parser());
    574575            progressMonitor.worked(1);
Note: See TracChangeset for help on using the changeset viewer.