Permalink
Browse files

Fix not include file encoding to UTF-8

  • Loading branch information...
EntryPointKR committed Sep 17, 2018
1 parent ddefc88 commit 6546bd98398ed52d45df4b840fcdb12adaf1fe5c
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/main/java/com/laytonsmith/core/AliasCore.java
@@ -34,7 +34,7 @@
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
@@ -43,6 +43,7 @@
import java.io.StringWriter;
import java.io.Writer;
import java.net.URI;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
@@ -536,14 +537,14 @@ public boolean reloadExtensions() {
* @throws Exception if the file cannot be found
*/
public static String file_get_contents(String fileLocation) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(fileLocation));
String ret = "";
String str;
while((str = in.readLine()) != null) {
ret += str + "\n";
StringBuilder ret = new StringBuilder();
try(BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fileLocation), Charset.forName("UTF-8")))) {
String str;
while((str = in.readLine()) != null) {
ret.append(str).append('\n');
}
}
in.close();
return ret;
return ret.toString();
}
/**

0 comments on commit 6546bd9

Please sign in to comment.