// 绑定到请求 Entry
StringEntity se = new StringEntity(params.toString(),"UTF-8");
/*
* for Encoding Test
System.out.println(params);
System.out.println(se);
System.out.println(EntityUtils.toString(se,"iso-8859-1"));
System.out.println(EntityUtils.toString(se,"gb2312"));
System.out.println(EntityUtils.toString(se,"gbk"));
System.out.println(EntityUtils.toString(se,"utf-8"));
*/
request.setEntity(se);
// 发送请求
HttpResponse httpResponse = new DefaultHttpClient().execute(request);
// 得到应答的字符串,这也是一个 JSON 格式保存的数据
StringEntity se = new StringEntity(params.toString(),"UTF-8");
/*
* for Encoding Test
System.out.println(params);
System.out.println(se);
System.out.println(EntityUtils.toString(se,"iso-8859-1"));
System.out.println(EntityUtils.toString(se,"gb2312"));
System.out.println(EntityUtils.toString(se,"gbk"));
System.out.println(EntityUtils.toString(se,"utf-8"));
*/
request.setEntity(se);
// 发送请求
HttpResponse httpResponse = new DefaultHttpClient().execute(request);
// 得到应答的字符串,这也是一个 JSON 格式保存的数据
String retSrc = EntityUtils.toString(httpResponse.getEntity());
通过StringEntity封好Json数据发送时候,将StringEntity se = new StringEntity(params.toString());
装好的数据中文都是?????
stringEntity.setContentEncoding(
"utf-8"
)------》这个没用!
后来new StringEntity中添加“UTF-8”编码设置,OK.............