POST中文转码问题-创新互联

//在 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(entity);
HttpResponse response = client.execute(httpPost); 
//获取响应码
status = response.getStatusLine().getStatusCode();
//status = response.getStatusLine().getStatusCode();
Log.v("jsondata", "resp = " + response.getEntity().toString());
Log.v("jsondata", "status = " + status + "\n" + contentValue.toString());
}catch(Exception e){
Log.v("jsondata", "exception");
e.printStackTrace();
}

创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。

创新互联建站专注于驻马店企业网站建设,响应式网站,商城开发。驻马店网站建设公司,为驻马店等地区提供建站服务。全流程定制网站开发,专业设计,全程项目跟踪,创新互联建站专业和态度为您提供的服务
新闻名称:POST中文转码问题-创新互联
路径分享:http://pwwzsj.com/article/dhijpd.html