fixed potential charset bug.
This commit is contained in:
parent
65eb31c3e9
commit
7dc316e7e4
1 changed files with 2 additions and 1 deletions
|
@ -22,6 +22,7 @@ import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
public class JsonFactory {
|
public class JsonFactory {
|
||||||
public final static Gson GSON = new GsonBuilder().setPrettyPrinting()
|
public final static Gson GSON = new GsonBuilder().setPrettyPrinting()
|
||||||
|
@ -69,7 +70,7 @@ public class JsonFactory {
|
||||||
Resource resource = manager.getResource(location);
|
Resource resource = manager.getResource(location);
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
InputStream stream = resource.getInputStream();
|
InputStream stream = resource.getInputStream();
|
||||||
InputStreamReader reader = new InputStreamReader(stream);
|
InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8);
|
||||||
obj = JsonFactory.GSON.fromJson(reader, JsonObject.class);
|
obj = JsonFactory.GSON.fromJson(reader, JsonObject.class);
|
||||||
reader.close();
|
reader.close();
|
||||||
stream.close();
|
stream.close();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue