Android—Volley:接收服务端发送的json数据乱码问题解决

new JsonObjectRequest中重写方法parseNetworkResponse,内容如下:

    /**
* 重写此方法不会导致乱码
*/
@Override
protected Response<JSONObject> parseNetworkResponse(
NetworkResponse response) {
response.headers.put("HTTP.CONTENT_TYPE", "utf-8");
try {
String jsonString = new String(response.data, "utf-8");
return Response.success(new JSONObject(jsonString),
HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
return Response.error(new ParseError(e));
} catch (JSONException e) {
// TODO Auto-generated catch block
return Response.error(new ParseError(e));
} }
上一篇:xampp环境下,配置Zend Studio调试php(XDebug) 转摘:http://www.cnblogs.com/tuyithief/archive/2011/06/02/2068431.html


下一篇:开启php的xdebug扩展及phpstorm配置xdebug,chrome调试插件组合