通过JSON发送日语字符 [英] Sending japanese characters over JSON
本文介绍了通过JSON发送日语字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试通过json发送日语字母,但是返回的json值为"jspString":"???????"
.我究竟做错了什么?谢谢!
I tried sending japanese letters via json, however, the json value returned is "jspString":"???????"
. What am I doing wrong? Thanks!
JSONObject info = new JSONObject();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
info.put("japString", "よやかなゆひま");
nameValuePairs.add(new BasicNameValuePair("info", info.toString()));
postCard.setEntity(new UrlEncodedFormEntity(nameValuePairs));
postResponse = postCardClient.execute(postCard);
postResponseEntity = postResponse.getEntity();
String printResult = EntityUtils.toString(postResponseEntity);
推荐答案
找到了答案:只需将toString()添加到info.put("japString", "よやかなゆひま".toString());
.在内部,它会转义unicode字符.
Found the answer: just add toString() to info.put("japString", "よやかなゆひま".toString());
. Internally, it escapes the unicode characters.
这篇关于通过JSON发送日语字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文