From a0c16dc4e13b8530df17bd7af33553842d6f013f Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 28 Aug 2020 08:34:01 +0400 Subject: [PATCH] Added charset check and hint in startup logs (related to #7020) --- Mage.Client/release/startClient.bat | 2 +- Mage.Client/release/startClient.command | 2 +- Mage.Client/release/startClient.sh | 2 +- Mage.Client/release/startClientWin7.bat | 2 +- Mage.Client/src/main/java/mage/client/MageFrame.java | 5 +++++ Mage.Server/release/startServer.bat | 2 +- Mage.Server/release/startServer.command | 2 +- Mage.Server/release/startServer.sh | 2 +- Mage.Server/release/startServerWin7.bat | 2 +- Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java | 2 +- 10 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Mage.Client/release/startClient.bat b/Mage.Client/release/startClient.bat index 3468041f2e..887e73d2ad 100644 --- a/Mage.Client/release/startClient.bat +++ b/Mage.Client/release/startClient.bat @@ -4,4 +4,4 @@ set JAVA_HOME="C:\Program Files\Java\jre7\" set CLASSPATH=%JAVA_HOME%/bin;%CLASSPATH% set PATH=%JAVA_HOME%/bin;%PATH% :NOJAVADIR -start javaw -Xms256m -Xmx512m -XX:MaxPermSize=384m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -jar .\lib\mage-client-${project.version}.jar \ No newline at end of file +start javaw -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -jar .\lib\mage-client-${project.version}.jar \ No newline at end of file diff --git a/Mage.Client/release/startClient.command b/Mage.Client/release/startClient.command index 47fe9c1be5..d3170d63a5 100644 --- a/Mage.Client/release/startClient.command +++ b/Mage.Client/release/startClient.command @@ -2,4 +2,4 @@ cd "`dirname "$0"`" -java -Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -jar ./lib/mage-client-${project.version}.jar & \ No newline at end of file +java -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -jar ./lib/mage-client-${project.version}.jar & \ No newline at end of file diff --git a/Mage.Client/release/startClient.sh b/Mage.Client/release/startClient.sh index 501ef2a66f..8a49731e24 100644 --- a/Mage.Client/release/startClient.sh +++ b/Mage.Client/release/startClient.sh @@ -1,3 +1,3 @@ #!/bin/sh -java -Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -jar ./lib/mage-client-${project.version}.jar & \ No newline at end of file +java -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -jar ./lib/mage-client-${project.version}.jar & \ No newline at end of file diff --git a/Mage.Client/release/startClientWin7.bat b/Mage.Client/release/startClientWin7.bat index 1ef71045b7..4e7e71d42b 100644 --- a/Mage.Client/release/startClientWin7.bat +++ b/Mage.Client/release/startClientWin7.bat @@ -4,4 +4,4 @@ set JAVA_HOME="C:\Program Files (x86)\Java\jre7\" set CLASSPATH=%JAVA_HOME%/bin;%CLASSPATH% set PATH=%JAVA_HOME%/bin;%PATH% :NOJAVADIR -start javaw -Xms256m -Xmx512m -XX:MaxPermSize=384m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -jar .\lib\mage-client-${project.version}.jar \ No newline at end of file +start javaw -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -jar .\lib\mage-client-${project.version}.jar \ No newline at end of file diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index b4c8b1bd74..dfba5b8de5 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -1270,6 +1270,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { LOGGER.info("Starting MAGE client version " + VERSION); LOGGER.info("Logging level: " + LOGGER.getEffectiveLevel()); LOGGER.info("Default charset: " + Charset.defaultCharset()); + if (!Charset.defaultCharset().toString().equals("UTF-8")) { + LOGGER.warn("WARNING, found wrong default charset. You must:"); + LOGGER.warn("* Open launcher -> settings -> java -> client java options"); + LOGGER.warn("* Insert additional command at the the end: -Dfile.encoding=UTF-8"); + } startTime = System.currentTimeMillis(); Thread.setDefaultUncaughtExceptionHandler((t, e) -> LOGGER.fatal(null, e)); diff --git a/Mage.Server/release/startServer.bat b/Mage.Server/release/startServer.bat index 36f799936d..bd771b699f 100644 --- a/Mage.Server/release/startServer.bat +++ b/Mage.Server/release/startServer.bat @@ -4,5 +4,5 @@ set JAVA_HOME="C:\Program Files\Java\jre7\" set CLASSPATH=%JAVA_HOME%/bin;%CLASSPATH% set PATH=%JAVA_HOME%/bin;%PATH% :NOJAVADIR -java -Xms256m -Xmx512m -XX:MaxPermSize=384m -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar +java -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar pause diff --git a/Mage.Server/release/startServer.command b/Mage.Server/release/startServer.command index 25a2c28773..cf36fffd09 100644 --- a/Mage.Server/release/startServer.command +++ b/Mage.Server/release/startServer.command @@ -2,4 +2,4 @@ cd "`dirname "$0"`" -java -Xms256M -Xmx512M -XX:MaxPermSize=256m -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar +java -Xms256M -Xmx512M -Dfile.encoding=UTF-8 -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar diff --git a/Mage.Server/release/startServer.sh b/Mage.Server/release/startServer.sh index d6aad3b250..848276923d 100755 --- a/Mage.Server/release/startServer.sh +++ b/Mage.Server/release/startServer.sh @@ -1,3 +1,3 @@ #!/bin/sh -java -Xms256M -Xmx512M -XX:MaxPermSize=256m -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar +java -Xms256M -Xmx512M -Dfile.encoding=UTF-8 -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar diff --git a/Mage.Server/release/startServerWin7.bat b/Mage.Server/release/startServerWin7.bat index e68dccb608..4aa27a4580 100644 --- a/Mage.Server/release/startServerWin7.bat +++ b/Mage.Server/release/startServerWin7.bat @@ -4,4 +4,4 @@ set JAVA_HOME="C:\Program Files (x86)\Java\jre7\" set CLASSPATH=%JAVA_HOME%/bin;%CLASSPATH% set PATH=%JAVA_HOME%/bin;%PATH% :NOJAVADIR -java -Xms256M -Xmx512M -XX:MaxPermSize=384m -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar \ No newline at end of file +java -Xms256M -Xmx512M -Dfile.encoding=UTF-8 -Djava.security.policy=./config/security.policy -Dlog4j.configuration=file:./config/log4j.properties -jar ./lib/mage-server-${project.version}.jar \ No newline at end of file diff --git a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java index d1e77dad43..4d38ed4e1c 100644 --- a/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/load/LoadTest.java @@ -34,7 +34,7 @@ import java.util.UUID; * started before running them. In case you want to debug these tests, use * -Ddebug.mage that would disable client-server request timeout. *

- * Then it's also better to use -Xms256M -Xmx512M JVM options for these stests. + * Then it's also better to use -Xms256M -Xmx512M JVM options for these tests. * * @author JayDi85 */