提交 58bd26e3 编写于 作者: 张乐 提交者: GitHub

Merge pull request #636 from nobodyiam/client-charset

fix default charset issue
...@@ -16,6 +16,7 @@ import com.google.common.base.Function; ...@@ -16,6 +16,7 @@ import com.google.common.base.Function;
import com.google.common.io.BaseEncoding; import com.google.common.io.BaseEncoding;
import com.google.common.io.CharStreams; import com.google.common.io.CharStreams;
import com.google.gson.Gson; import com.google.gson.Gson;
import java.nio.charset.StandardCharsets;
/** /**
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
...@@ -104,7 +105,7 @@ public class HttpUtil { ...@@ -104,7 +105,7 @@ public class HttpUtil {
statusCode = conn.getResponseCode(); statusCode = conn.getResponseCode();
if (statusCode == 200) { if (statusCode == 200) {
isr = new InputStreamReader(conn.getInputStream()); isr = new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8);
String content = CharStreams.toString(isr); String content = CharStreams.toString(isr);
return new HttpResponse<>(statusCode, serializeFunction.apply(content)); return new HttpResponse<>(statusCode, serializeFunction.apply(content));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册