1

我正在使用 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();

        }

    }
4

0 回答 0