我收到了UnsupportedEncodingException,因为我将其作为内容类型Content-Type: application/json;charset=UTF-8'
而不是正确的application/json;charset=UTF-8
返回(请注意'在结尾处字符集)。有没有办法忽略这个不受支持的角色?
我收集数据的方式是:
private static String download(String theUrl, String errorMessage)
{
String result = "";
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, Integer.parseInt(connectionTimeOut + "000"));
HttpClient client = new CustomHttpClient(httpParameters).getNewHttpClient();
HttpGet request = new HttpGet(theUrl);
ResponseHandler<String> handler = new BasicResponseHandler();
result = client.execute(request, handler);
return result;
}