fix: doGet utf-8. #992.

This commit is contained in:
huanghongxun 2021-09-12 02:32:21 +08:00
parent 475d7f50f1
commit b10330548e

View File

@ -21,6 +21,7 @@ import org.jackhuang.hmcl.util.Pair;
import java.io.*; import java.io.*;
import java.net.*; import java.net.*;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -173,7 +174,7 @@ public final class NetworkUtils {
public static String doGet(URL url) throws IOException { public static String doGet(URL url) throws IOException {
HttpURLConnection con = createHttpConnection(url); HttpURLConnection con = createHttpConnection(url);
con = resolveConnection(con); con = resolveConnection(con);
return IOUtils.readFullyAsString(con.getInputStream()); return IOUtils.readFullyAsString(con.getInputStream(), StandardCharsets.UTF_8);
} }
public static String doPost(URL u, Map<String, String> params) throws IOException { public static String doPost(URL u, Map<String, String> params) throws IOException {