From 1b39f67032eb0565a82ff2465f56719028eb6f0f Mon Sep 17 00:00:00 2001 From: PasserbyAlpha Date: Fri, 22 Apr 2022 23:11:29 +0800 Subject: [PATCH] fixed encoding problem when generating gm handbook --- src/main/java/emu/grasscutter/tools/Tools.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index 6f6466773..fd614f4c1 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -1,8 +1,11 @@ package emu.grasscutter.tools; +import java.io.FileInputStream; import java.io.FileReader; import java.io.FileWriter; +import java.io.InputStreamReader; import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; @@ -30,7 +33,7 @@ public final class Tools { ResourceLoader.loadResources(); Map 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>() {}.getType()); }