Android 由于ñ;性格

Android 由于ñ;性格,android,mysqli,Android,Mysqli,我试图读取一个mysql数据库,当我添加字符ñ时,这段代码抛出org.json.JSONException:End-of字符0处的输入 StringBuilder sb = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader( is, "UTF-8"), 500);

我试图读取一个mysql数据库,当我添加字符ñ时,这段代码抛出org.json.JSONException:End-of字符0处的输入

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());
            }
在BufferedReader中,我尝试使用字符集UTF-8和ISO-8859-1。在数据库中,我尝试使用utf8_bin和拉丁语1。我认为问题也可能出在PHP中,就是这样

mysqli_select_db($conn,$DBName) or die("Unable to select la database    $DBName");

$response = array();

$result = mysqli_query($conn, "SELECT *FROM $table") or die(mysql_error());

if (mysqli_num_rows($result) > 0) {
// looping through all results
$response["post"] = array();

while ($row = mysqli_fetch_array($result)) {
    $product = array();
    $product["User"] = $row["User"];
    $product["Date"] = $row["Date"];
    $product["Time"] = $row["Time"];
    $product["About"] = $row["About"];
    $product["PostText"] = $row["PostText"];
    $product["Score"] = $row["Score"];

知道问题出在哪里吗?谢谢

这意味着您没有从后端Api获取任何数据。尝试使用log.d在logcat上打印响应。这意味着您没有从后端Api获得任何数据。尝试使用log.d在logcat上打印响应。