修复使用 Java 19+ 启动游戏时控制台乱码的问题 (#2846)

This commit is contained in:
Glavo
2024-02-22 23:20:30 +08:00
committed by GitHub
parent 9f6124d617
commit 02065094ca

View File

@@ -150,8 +150,14 @@ public class DefaultLauncher extends Launcher {
LOG.log(Level.WARNING, "Bad file encoding", ex);
}
}
res.addDefault("-Dsun.stdout.encoding=", encoding.name());
res.addDefault("-Dsun.stderr.encoding=", encoding.name());
if (options.getJava().getParsedVersion() < 19) {
res.addDefault("-Dsun.stdout.encoding=", encoding.name());
res.addDefault("-Dsun.stderr.encoding=", encoding.name());
} else {
res.addDefault("-Dstdout.encoding=", encoding.name());
res.addDefault("-Dstderr.encoding=", encoding.name());
}
// Fix RCE vulnerability of log4j2
res.addDefault("-Djava.rmi.server.useCodebaseOnly=", "true");