//在 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(); }
POST中文转码问题
原创
©著作权归作者所有:来自51CTO博客作者671076656的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:Http请求获取返回值
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
详解音视频转码工具ffmpeg
详解ffmpeg
ide 封装 音视频