Make configuration use utf8
Some checks failed
build / build (17, ubuntu-22.04) (push) Has been cancelled
build / build (17, windows-2022) (push) Has been cancelled

This commit is contained in:
7cc5c4f330d47060 2024-09-02 15:32:37 -04:00
parent 94aafd7b7c
commit c2f715fb46
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA

View file

@ -27,6 +27,7 @@ import net.minecraft.util.math.BlockPos;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import java.nio.charset.Charset;
public class ChipmunkMod implements ModInitializer {
// This logger is used to write text to the console and the log file.
@ -88,7 +89,7 @@ public class ChipmunkMod implements ModInitializer {
}
InputStream is = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF8")));
return gson.fromJson(reader, Configuration.class);
}
@ -96,7 +97,7 @@ public class ChipmunkMod implements ModInitializer {
public static void saveConfig() throws IOException {
Gson otherGson = new GsonBuilder().serializeNulls().setLenient().setPrettyPrinting().create();
String defaultConfig = otherGson.toJson(CONFIG);
BufferedWriter configWriter = new BufferedWriter(new FileWriter(CONFIG_FILE));
BufferedWriter configWriter = new BufferedWriter(new FileWriter(CONFIG_FILE, Charset.forName("UTF8")));
configWriter.write(defaultConfig);
configWriter.close();
}