2016-08-16 01:47:02 +02:00
|
|
|
From 2b84f26c4d3b06e90badd6260f35745967817f0e Mon Sep 17 00:00:00 2001
|
2016-05-28 18:34:39 +02:00
|
|
|
From: kamcio96 <k.nadworski@icloud.com>
|
|
|
|
Date: Sat, 21 May 2016 17:17:36 -0600
|
|
|
|
Subject: [PATCH] Fix unicode characters in configuration files
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/config/src/main/java/net/md_5/bungee/config/YamlConfiguration.java b/config/src/main/java/net/md_5/bungee/config/YamlConfiguration.java
|
2016-08-16 01:47:02 +02:00
|
|
|
index db8aa4b..9258d7d 100644
|
2016-05-28 18:34:39 +02:00
|
|
|
--- a/config/src/main/java/net/md_5/bungee/config/YamlConfiguration.java
|
|
|
|
+++ b/config/src/main/java/net/md_5/bungee/config/YamlConfiguration.java
|
|
|
|
@@ -1,16 +1,25 @@
|
|
|
|
package net.md_5.bungee.config;
|
|
|
|
|
|
|
|
+import java.io.BufferedReader;
|
|
|
|
+import java.io.BufferedWriter;
|
|
|
|
import java.io.File;
|
|
|
|
+import java.io.FileInputStream;
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
|
import java.io.FileReader;
|
|
|
|
import java.io.FileWriter;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
+import java.io.InputStreamReader;
|
|
|
|
+import java.io.OutputStreamWriter;
|
|
|
|
import java.io.Reader;
|
|
|
|
import java.io.Writer;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import lombok.AccessLevel;
|
|
|
|
import lombok.NoArgsConstructor;
|
|
|
|
+
|
|
|
|
+import com.google.common.base.Charsets;
|
|
|
|
+
|
|
|
|
import org.yaml.snakeyaml.DumperOptions;
|
|
|
|
import org.yaml.snakeyaml.Yaml;
|
2016-08-16 01:47:02 +02:00
|
|
|
import org.yaml.snakeyaml.constructor.Constructor;
|
|
|
|
@@ -51,7 +60,7 @@ public class YamlConfiguration extends ConfigurationProvider
|
2016-05-28 18:34:39 +02:00
|
|
|
@Override
|
|
|
|
public void save(Configuration config, File file) throws IOException
|
|
|
|
{
|
|
|
|
- try ( FileWriter writer = new FileWriter( file ) )
|
|
|
|
+ try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8)))
|
|
|
|
{
|
|
|
|
save( config, writer );
|
|
|
|
}
|
2016-08-16 01:47:02 +02:00
|
|
|
@@ -72,7 +81,7 @@ public class YamlConfiguration extends ConfigurationProvider
|
2016-05-28 18:34:39 +02:00
|
|
|
@Override
|
|
|
|
public Configuration load(File file, Configuration defaults) throws IOException
|
|
|
|
{
|
|
|
|
- try ( FileReader reader = new FileReader( file ) )
|
|
|
|
+ try (Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charsets.UTF_8)))
|
|
|
|
{
|
|
|
|
return load( reader, defaults );
|
|
|
|
}
|
|
|
|
--
|
2016-08-16 01:47:02 +02:00
|
|
|
2.8.2
|
2016-05-28 18:34:39 +02:00
|
|
|
|