Changeset 34017 in osm for applications
- Timestamp:
- 2018-01-16T19:42:25+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java
r33518 r34017 18 18 import java.nio.file.Path; 19 19 import java.text.SimpleDateFormat; 20 import java.util.Arrays; 20 21 import java.util.Date; 21 22 import java.util.HashMap; … … 192 193 if (Files.exists(cpg)) { 193 194 try (BufferedReader reader = Files.newBufferedReader(cpg, StandardCharsets.UTF_8)) { 194 charset = Charset.forName(reader.readLine()); 195 String cs = reader.readLine(); 196 if (cs.matches("\\d+")) { 197 // We only have the code page number, we need to find the good alias for java.nio API 198 // see https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html 199 for (String prefix : Arrays.asList("IBM", "IBM0", "IBM00", "x-IBM", "ISO-", "windows-", "x-windows-")) { 200 try { 201 charset = Charset.forName(prefix+cs); 202 break; 203 } catch (UnsupportedCharsetException | IllegalCharsetNameException e) { 204 Logging.trace(e); 205 } 206 } 207 } else { 208 // We may have a charset name, such as "UTF-8" 209 charset = Charset.forName(cs); 210 } 195 211 } catch (IOException | UnsupportedCharsetException | IllegalCharsetNameException e) { 196 212 Logging.warn(e);
Note:
See TracChangeset
for help on using the changeset viewer.