我android源代码文件是ASCII格式的,服务器上文件也是ASCII格式的,但是我获取网页的中文显示却是乱码。请问怎么解决,以下是我程序里代码 httpRequest.setEntity(new UrlEncodedFormEntity(params, HTTP.ASCII));
/*取得HTTP response*/
HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest);
/*若状态码为200 ok*/
if(httpResponse.getStatusLine().getStatusCode() == 200)
{
/*取出响应字符串*/
String strResult = EntityUtils.toString(httpResponse.getEntity());
jarry = new JSONArray(strResult); //JSONObject jsonObject = new JSONObject(strResult);
//gjx1 = jsonObject.getString("gjxname");
//j1 = jsonObject.getString("j");
//w1 = jsonObject.getString("w");
}
else
{
}
/*取得HTTP response*/
HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest);
/*若状态码为200 ok*/
if(httpResponse.getStatusLine().getStatusCode() == 200)
{
/*取出响应字符串*/
String strResult = EntityUtils.toString(httpResponse.getEntity());
jarry = new JSONArray(strResult); //JSONObject jsonObject = new JSONObject(strResult);
//gjx1 = jsonObject.getString("gjxname");
//j1 = jsonObject.getString("j");
//w1 = jsonObject.getString("w");
}
else
{
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货