Skip to content

Commit

Permalink
use OutputStreamWriter to ensure the charset of output is utf8 [from …
Browse files Browse the repository at this point in the history
…fumbling644o]
  • Loading branch information
PasserbyAlpha committed Apr 22, 2022
1 parent 1b39f67 commit 2750d5d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/emu/grasscutter/tools/Tools.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
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;
Expand Down Expand Up @@ -39,7 +41,7 @@ public static void createGmHandbook() throws Exception {

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();

Expand Down

0 comments on commit 2750d5d

Please sign in to comment.