From 76faea3fc76cd5f904de28fd7ecc2b756574e85b Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Thu, 8 Dec 2016 22:08:02 +0100 Subject: [PATCH] Save: set default encoding to utf-8 in all systems --- src/main/java/es/kauron/jstudy/model/TestItem.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/es/kauron/jstudy/model/TestItem.java b/src/main/java/es/kauron/jstudy/model/TestItem.java index 88fa56f..0a2a53d 100644 --- a/src/main/java/es/kauron/jstudy/model/TestItem.java +++ b/src/main/java/es/kauron/jstudy/model/TestItem.java @@ -4,6 +4,7 @@ import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import java.io.*; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.InputMismatchException; import java.util.List; @@ -53,7 +54,8 @@ public class TestItem { public static void saveTo(File file, List data) { try { - OutputStreamWriter writer = new FileWriter(file); + OutputStreamWriter writer = new OutputStreamWriter( + new FileOutputStream(file), Charset.forName("UTF-8").newEncoder()); for (TestItem item : data) { writer.write(item.getQuestion() + "::" + item.getAnswer() + "\n"); }