Skip to content

Commit

Permalink
use utf-8 as default charset
Browse files Browse the repository at this point in the history
  • Loading branch information
GraxCode committed Mar 6, 2018
1 parent 62b9368 commit d0cdfa3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/me/grax/jbytemod/JByteMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.awt.event.WindowEvent;
import java.io.File;
import java.lang.instrument.Instrumentation;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -110,6 +112,14 @@ private static void initialize() {
LOGGER = new Logging();
res = new LanguageRes();
ops = new Options();
try {
System.setProperty("file.encoding","UTF-8");
Field charset = Charset.class.getDeclaredField("defaultCharset");
charset.setAccessible(true);
charset.set(null,null);
} catch(Throwable t) {
JByteMod.LOGGER.err("Failed to set encoding to UTF-8 (" + t.getMessage() + ")");
}
}

/**
Expand Down

0 comments on commit d0cdfa3

Please sign in to comment.