0
這並不轉換爲å
轉換爲國際字符不使用jsonobject.tostring,但與字符串文字?
String j_post = new String((byte[]) j_posts.getJSONObject(i).get("tagline").toString().getBytes("utf-8"), "utf-8");
但下面確實
String j_post = new String((byte[]) "\u00e5".getBytes("utf-8"), "utf-8");
如何解決這個問題?
更新:現在我試圖修復編碼之前,我把它作爲JSONObject,它仍然無法正常工作。
json = new JSONObject(new String((byte[]) jsonContent.getBytes("utf-8"), "utf-8"));
JSONArray j_posts = json.getJSONArray("posts");
for (int i = 0; i<j_posts.length();i++){
//[String(byte[] data)][2]
String j_post =j_posts.getJSONObject(i).get("tagline").toString();
post_data.add(new Post(j_post));
}
請注意,我收到一個字符串作爲我的網絡服務器的響應。
我嘗試了你的建議,但它仍然無法正常工作。 – 2013-03-04 14:40:09
我在提交數據時出錯。雖然我不能讓我的代碼工作,但這似乎是一個合理的答案。謝謝你的時間。我會更新這個線程,如果我找出什麼是錯的。 – 2013-03-04 19:43:03