mirror of
https://gitlab.com/kauron/jstudy
synced 2024-11-13 07:33:44 +01:00
Save: set default encoding to utf-8 in all systems
This commit is contained in:
parent
76bff4c84b
commit
76faea3fc7
1 changed files with 3 additions and 1 deletions
|
@ -4,6 +4,7 @@ import javafx.beans.property.SimpleStringProperty;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.InputMismatchException;
|
import java.util.InputMismatchException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -53,7 +54,8 @@ public class TestItem {
|
||||||
|
|
||||||
public static void saveTo(File file, List<TestItem> data) {
|
public static void saveTo(File file, List<TestItem> data) {
|
||||||
try {
|
try {
|
||||||
OutputStreamWriter writer = new FileWriter(file);
|
OutputStreamWriter writer = new OutputStreamWriter(
|
||||||
|
new FileOutputStream(file), Charset.forName("UTF-8").newEncoder());
|
||||||
for (TestItem item : data) {
|
for (TestItem item : data) {
|
||||||
writer.write(item.getQuestion() + "::" + item.getAnswer() + "\n");
|
writer.write(item.getQuestion() + "::" + item.getAnswer() + "\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue