//在,new StringEntity (params,“utf - 8”)指定为utf - 8编码
try {
HttpClient client =, new DefaultHttpClient (),,
HttpPost HttpPost =, new HttpPost (url);//设置编码,防止中文传输乱码,
StringEntity entity =, new StringEntity (contentValue.toString (),“utf - 8”);
httpPost.setEntity(实体);
HttpResponse response =, client.execute (httpPost);,//获取响应码
.getStatusCode status =, response.getStatusLine () ();//status =, response.getStatusLine () .getStatusCode ();
Log.v (“jsondata”,,“resp =,, +, response.getEntity () .toString ());
Log.v (“jsondata”,,“status =,, +, status +,“\ n”, +, contentValue.toString ());
}捕捉(Exception e) {
Log.v (“jsondata”,“例外”);
e.printStackTrace ();
} >之前