Android到MySQL土耳其语字符写作“?”

时间:2014-01-02 16:19:39

标签: php android mysql

当我获取EditText的文本并将其写入MySQL数据库时,土耳其语字符会以“?”的形式进入数据库。奇怪的部分是“ö,ü,ç”很好。问题是“ı”和“ğ”。当我直接输入它时也可以。我的问题是Android部分还是PHP部分,还是别的?

        <?php



    // array for JSON response
    $response = array();

    // check for required fields
    if (isset($_POST['AdayTC'])) {

       $AdayTC = $_POST['AdayTC'];
       $OzGecmis = $_POST['OzGecmis'];
       $Projeleri = $_POST['Projeleri'];

       // include db connect class
        require_once __DIR__ . '/db_connect.php';

        // connecting to db
        $db = new DB_CONNECT();

        $basvuruKontrol = mysql_query("SELECT AdayTC FROM adaybasvurusu WHERE AdayTC = '$AdayTC'");
    if(mysql_num_rows($basvuruKontrol) == 0) {
                    $result = mysql_query("INSERT INTO adaybasvurusu (AdayTC, OzGecmis, Projeleri, Onay) VALUES ('$AdayTC', '$OzGecmis', '$Projeleri',0)");
                        $response["success"] = 1;
                        $response["message"] = "Basvuru Gonderildi";

                        // echoing JSON response
                        echo json_encode($response);
                    } else {
                    // failed to insert row
                        $response["success"] = 0;
                        $response["message"] = "Zaten Basvuru Yapilmis";

                        // echoing JSON response
                        echo json_encode($response);
                            }

    } else {
        // required field is missing
        $response["success"] = 0;
        $response["message"] = "Gerekli Alanlar Eksik";

        // echoing JSON response
        echo json_encode($response);
    }
    ?>

修改

我尝试添加mysql_error()函数:

 echo mysql_errno($result) . ": " . mysql_error($result) . "\n";

...现在我在错误日志中得到了这个:

 [03-Jan-2014 11:43:00 UTC] PHP Parse error:  syntax error, unexpected T_ECHO in /home/xxx/public_html/xxx/adaybasvuru.php on line 29

第29行是我添加echo mysql_error函数的行。

1 个答案:

答案 0 :(得分:0)

似乎问题出在JSONParser类上,我能够解决我的问题。

if(method == "POST"){
                // request method is POST
                // defaultHttpClient
                DefaultHttpClient httpClient = new DefaultHttpClient();
                HttpPost httpPost = new HttpPost(url);
                StringEntity entity = new UrlEncodedFormEntity(params,"latin5");
                httpPost.setEntity(entity);


                HttpResponse httpResponse = httpClient.execute(httpPost);
                HttpEntity httpEntity = httpResponse.getEntity();
                is = httpEntity.getContent();

            }