0
字符串这是我的代码:解压gzip JSON响应的Android
try {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new StringEntity(strJson, "UTF-8"));
httpPost.setHeader("api_key", "<TSssssssssssssaaa7>");
httpPost.setHeader("Content-Type", "application/json");
httpPost.setHeader("Accept-Encoding", "gzip");
response = httpClient.execute(httpPost);
resp=EntityUtils.toString(response.getEntity(), "UTF-8");
Log.w("QueingSystem", strJson);
Log.w("QueingSystem", EntityUtils.toString(response.getEntity(), "UTF-8"));
Log.w("QueingSystem", EntityUtils.toString(response.getEntity()));
} catch (Exception e) {
Log.d("InputStream", e.getLocalizedMessage());
}
而且我在日志中输出如下:
��������������V*J-.��+NU��VJ�O�&�:J���ʼn�@��ciIFj^IfrbIf~��[bfNj�Rm-���n��;������
任何一个可以帮我得到确切的以字符串格式输出json响应?
实体=新GzipDecompressingEntity(实体);我得到一个错误无法解决 –