http 返回的数据解析后 汉字格式不对"\u516c\u53f8\u5927\u4f1a"

gjhrhuan 2012-10-08 06:31:47
android http发送post请求后 返回的数据,解析后,数字、字母都正常,但是汉字变成 "\u516c\u53f8\u5927\u4f1a"这种类型,怎么再转换成汉字呢? 因为我要将他再赋值给其他string,并显示成汉字(如:string str = ret。).
求教?急啊,急啊,急啊!

我的代码如下:
DefaultHttpClient mHttpClient=new DefaultHttpClient();
HttpPost mHttpPost=new HttpPost(url);
List<NameValuePair> nvp= new ArrayList<NameValuePair>();
nvp.add(new BasicNameValuePair("userId", accid));
mHttpPost.setEntity(new UrlEncodedFormEntity(nvp));
HttpResponse mHttpResp=mHttpClient.execute(mHttpPost);

String ret = EntityUtils.toString(mHttpResp.getEntity(), "UTF-8");
Toast.makeText(CheckListView5.this, ret, Toast.LENGTH_LONG).show();
此处ret为"\u516c\u53f8\u5927\u4f1a"这种格式。而我希望带到的是汉字,如:“中国”。
...全文
268 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
gaofq 2013-08-19
  • 打赏
  • 举报
回复
同求,同求,

80,337

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧