如何从我的android的openshift mysql数据库中读取阿拉伯语

时间:2016-06-17 13:46:24

标签: android json database utf-8 arabic

由于某些原因,我需要在我的应用程序中使用json字符串。这是字符串变量内容: 请告诉我解决方案     当我使用我的json类来显示这个varibale时,我得到了??????而不是阿拉伯字符。

    RequestParams g = new RequestParams();
    g.put("ID", ID);
    g.put("year", YEAR);
    AsyncHttpClient client = new AsyncHttpClient();
    client.get("********", *****,
    new AsyncHttpResponseHandler(){

                @Override
                public void onSuccess(String response) {
                    Marks=new ArrayList<String>();
                    Subjects=new ArrayList<String>();
                    DataToShow=new ArrayList<String>();
                    try {

                        // JSON Object
                        JSONObject obj = new JSONObject(response);
                        Log.d("DATAAAAAAAA", response);
                        if (obj.getString("status").equals("true")) {
                            JSONArray co = obj.getJSONArray("names");
                            JSONObject obj2;
                            for (int i = 0; i < co.length(); i++) {
                                obj2 = co.getJSONObject(i);
                                Marks.add(obj2.getString("subjectmark"));
                                Subjects.add(obj2.getString("subjectname"));
                                DataToShow.add(obj2.getString("subjectmark")+":....:"+obj2.getString("subjectname"));
                            }
                            MyADApter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, DataToShow);
                            MYMArksLISTVIEW.setAdapter(MyADApter);

                        }

                    } catch (JSONException e) {
                        Toast.makeText(getApplicationContext(),
                                "Error Occured [Server's JSON response might be invalid] at favorite!",
                                Toast.LENGTH_LONG).show();
                        e.printStackTrace();

                    }
                }

                @Override
                public void onFailure(int statusCode, Throwable error, String content) {
                    Toast.makeText(getApplicationContext(),
                            "Error Occured [Server's JSON response might be invalid] at favorite!",
                            Toast.LENGTH_LONG).show();

                }
            });

0 个答案:

没有答案