Fixed messy reading caused by charset.

This commit is contained in:
huangyuhui
2017-02-09 12:31:57 +08:00
parent 2ece71aae3
commit 6fe451c247
2 changed files with 4 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ def buildnumber = System.getenv("TRAVIS_BUILD_NUMBER")
if (buildnumber == null)
buildnumber = System.getenv("BUILD_NUMBER")
if (buildnumber == null)
buildnumber = "4"
buildnumber = "5"
def versionroot = System.getenv("VERSION_ROOT")
if (versionroot == null)

View File

@@ -32,6 +32,7 @@ import org.jackhuang.hellominecraft.util.EventHandler;
import org.jackhuang.hellominecraft.util.sys.FileUtils;
import org.jackhuang.hellominecraft.util.MessageBox;
import org.jackhuang.hellominecraft.util.UpdateChecker;
import org.jackhuang.hellominecraft.util.sys.IOUtils;
/**
*
@@ -70,7 +71,7 @@ public final class Settings {
Config c = new Config();
if (SETTINGS_FILE.exists())
try {
String str = FileUtils.read(SETTINGS_FILE);
String str = FileUtils.read(SETTINGS_FILE, IOUtils.DEFAULT_CHARSET);
if (str == null || str.trim().equals(""))
HMCLog.log("Settings file is empty, use the default settings.");
else {
@@ -92,7 +93,7 @@ public final class Settings {
public static void save() {
try {
FileUtils.write(SETTINGS_FILE, C.GSON.toJson(SETTINGS));
FileUtils.write(SETTINGS_FILE, C.GSON.toJson(SETTINGS), IOUtils.DEFAULT_CHARSET);
} catch (IOException ex) {
HMCLog.err("Failed to save config", ex);
}