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));
} }