Changeset 4801 in josm for trunk


Ignore:
Timestamp:
2012-01-16T08:50:16+01:00 (13 years ago)
Author:
simon04
Message:

fix #7271 - discard UTF8_BOM (0xFEFF) from GetCapabilities response

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java

    r4594 r4801  
    347347            String line;
    348348            StringBuilder ba = new StringBuilder();
    349             while((line = br.readLine()) != null) {
     349            boolean isFirstLine = true;
     350            while ((line = br.readLine()) != null) {
     351                // fix #7271
     352                // see http://www.rgagnon.com/javadetails/java-handle-utf8-file-with-bom.html
     353                final String UTF8_BOM = "\uFEFF";
     354                if (isFirstLine && line.startsWith(UTF8_BOM)) {
     355                    System.out.println("Removing UTF8_BOM (0xFEFF) from GetCapabilities response");
     356                    line = line.substring(1);
     357                    isFirstLine = false;
     358                }
    350359                ba.append(line);
    351360                ba.append("\n");
Note: See TracChangeset for help on using the changeset viewer.