Changeset 4801 in josm


Ignore:
Timestamp:
Jan 16, 2012 8:50:16 AM (16 months 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.