我正在尝试读取一个mysql数据库,当我添加字符ñ时,此代码抛出org.json.JSONException:输入结束于
的字符0array.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());
}
知道问题出在哪里?谢谢