I tried sending japanese letters via json, however, the json value returned is "japaneseString":"???????"
. What am I doing wrong? Thanks!
JSONObject info = new JSONObject();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
info.put("japaneseString", "よやかなゆひま");
nameValuePairs.add(new BasicNameValuePair("info", info.toString()));
postCard.setEntity(new UrlEncodedFormEntity(nameValuePairs));
postResponse = postCardClient.execute(postCard);
postResponseEntity = postResponse.getEntity();
String printResult = EntityUtils.toString(postResponseEntity);
Found the answer: just add toString() to info.put("japaneseString", "よやかなゆひま".toString());
. Internally, it escapes the unicode characters.