Android Exception由于ñ字符而在字符0处输入结束

时间:2015-12-18 15:41:10

标签: android mysqli

我正在尝试读取一个mysql数据库,当我添加字符ñ时,此代码抛出org.json.JSONException:输入结束于

的字符0
array.value_at(indices_array) # => ["y", "X", "o", "q"]

在BufferedReader中,我尝试使用字符集UTF-8和ISO-8859-1。在数据库中,我尝试过使用utf8_bin和latin1。我认为这个问题也可能出在PHP这个

StringBuilder sb = new StringBuilder();

                BufferedReader reader = new BufferedReader(new InputStreamReader(
                        is, "UTF-8"), 500);
                String line = null;
                while ((line = reader.readLine()) != null) {
                    sb.append(line + "\n");


                }
                is.close();
                json = sb.toString();
                Log.e("Here", "the string is"+json); //Nothing appear
                    try {

                        jObj = new JSONObject(json);
                    } catch (JSONException e) {
                        Log.e("JSON Parser Error", "" + e.toString());
                    }

            } catch (Exception e) {
                Log.e(" Buffer error", "" + e.toString());
            }

知道问题出在哪里?谢谢

0 个答案:

没有答案
相关问题