gpt4 book ai didi

php - Android 到 MySQL 土耳其语字符写入为 "?"

转载 作者:行者123 更新时间:2023-11-30 00:52:01 26 4
gpt4 key购买 nike

当我获取 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函数的行。

最佳答案

问题似乎出在 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();

}

关于php - Android 到 MySQL 土耳其语字符写入为 "?",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20887072/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com