mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 09:47:28 +00:00
Merge pull request #125 from PasserbyAlpha/fix_encoding_in_handbook
fixed encoding problem when generating gm handbook
This commit is contained in:
commit
ca6315f29a
@ -1,8 +1,13 @@
|
||||
package emu.grasscutter.tools;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
@ -30,13 +35,13 @@ public final class Tools {
|
||||
ResourceLoader.loadResources();
|
||||
|
||||
Map<Long, String> map;
|
||||
try (FileReader fileReader = new FileReader(Utils.toFilePath(Grasscutter.getConfig().RESOURCE_FOLDER + "TextMap/TextMapEN.json"))) {
|
||||
try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream(Utils.toFilePath(Grasscutter.getConfig().RESOURCE_FOLDER + "TextMap/TextMapEN.json")), StandardCharsets.UTF_8)) {
|
||||
map = Grasscutter.getGsonFactory().fromJson(fileReader, new TypeToken<Map<Long, String>>() {}.getType());
|
||||
}
|
||||
|
||||
List<Integer> list;
|
||||
String fileName = "./GM Handbook.txt";
|
||||
try (FileWriter fileWriter = new FileWriter(fileName); PrintWriter writer = new PrintWriter(fileWriter)) {
|
||||
try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(fileName), StandardCharsets.UTF_8), false)) {
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user