Add the setting changes encoding for CSV file to the preference dialog

(cherry picked from commit 11210b6d8b4584621ef02e7356854ffa9f7f2647)
This commit is contained in:
AOE Takashi
2019-10-18 16:30:29 +09:00
parent 8e0e1c41c3
commit 02b102cfb2
12 changed files with 303 additions and 5 deletions

View File

@@ -34,6 +34,7 @@ import org.supercsv.io.ICsvMapWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Map;
import static java.util.stream.Collectors.toMap;
@@ -53,7 +54,8 @@ public class CSVFileWriter extends CSVConfigurable implements ninja.javafx.smart
public void write(File filename) throws IOException {
ICsvMapWriter mapWriter = null;
try {
mapWriter = new CsvMapWriter(new FileWriter(filename.getAbsolutePath()), csvPreference);
mapWriter = new CsvMapWriter(new FileWriter(filename.getAbsolutePath(), Charset.forName(fileEncoding)),
csvPreference);
mapWriter.writeHeader(model.getHeader());
for(CSVRow row: model.getRows()) {