From: Reino Ruusu Date: Mon, 31 Aug 2020 13:07:03 +0000 (+0300) Subject: Use default charset for tech type CSV parsing X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F17%2F4417%2F3;p=simantics%2Fdistrict.git Use default charset for tech type CSV parsing gitlab #93 Change-Id: Iba22b4ea4db7a772664e2b76ab44a88a70ea8e80 --- diff --git a/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java b/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java index 0b6edb5f..d9dac92c 100644 --- a/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java +++ b/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java @@ -2,6 +2,7 @@ package org.simantics.district.imports; import java.io.IOException; import java.io.Reader; +import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -65,7 +66,7 @@ public class DistrictImportUtils { public static Map readCSVHeader(Path source, CSVFormat format, boolean firstAsHeader) throws IOException { if (firstAsHeader) format = format.withFirstRecordAsHeader(); - try (CSVParser parser = format.parse(Files.newBufferedReader(source))) { + try (CSVParser parser = format.parse(Files.newBufferedReader(source, Charset.defaultCharset()))) { return parser.getHeaderMap(); } } diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java index eb83c902..3b3d4a70 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java @@ -196,7 +196,7 @@ public class TechTypeTable extends Composite { public void setTechTypePath(String path) { String data; try { - data = Files.lines(Paths.get(path)).collect(Collectors.joining("\n")); + data = Files.lines(Paths.get(path), Charset.defaultCharset()).collect(Collectors.joining("\n")); } catch (IOException e) { LOGGER.error("Failed to read contents of file '{}' as {}", path, Charset.defaultCharset(), e); return;