私はjson配列を使用しており、.txtファイルを介してテキストを解析していますが、中に漢字があり、正しく表示できないようです。
私のtxtファイル出力:
{
"guides": [
{
"description": "Download magazines/下载杂志",
"image": "http://58.185.41.178/magazine_android/guide/download.png"
},
{
"description": "Delete magazines/删除杂志",
"image": "http://58.185.41.178/magazine_android/guide/trash.png"
},
{
"description": "Preview magazines",
"image": "http://58.185.41.178/magazine_android/guide/preview.png"
},
{
"description": "Update magazine issues/更新杂志",
"image": "http://58.185.41.178/magazine_android/guide/refresh.png"
},
{
"description": "Settings/设置",
"image": "http://58.185.41.178/magazine_android/guide/settings.png"
},
{
"description": "Read magazine/阅读杂志",
"image": "http://58.185.41.178/magazine_android/guide/magazine.png"
}
]
}
しかし、出力は常に奇妙な中国語のテキストになります! 例http://i49.tinypic.com/211tnco.jpg
これは私のjsonです
class LoadGuide extends AsyncTask<String, String, String> {
/**
* getting All videos from url
* */
protected String doInBackground(String... args) {
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
// getting JSON string from URL
JSONObject json = jParser.makeHttpRequest(url_guide, "GET", params);
// CHECKING OF JSON RESPONSE
Log.d("All guide: ", json.toString());
try {
guide = json.getJSONArray(TAG_GUIDES);
for (int i = 0; i < guide.length(); i++) {
JSONObject c = guide.getJSONObject(i);
//String title = c.getString(TAG_DESCRIPTION);
String image = c.getString(TAG_IMAGE);
String description = c.getString(TAG_DESCRIPTION);
guideList.add(image);
descriptionList.add(description);
System.out.println(guideList);
System.out.println(descriptionList);
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url) {
/**
* Updating parsed JSON data into ListView
* */
adapter.notifyDataSetChanged();
}
}