PHP MYSQL 编码问题(土耳其语字符) [英] PHP MYSQL encoding issue ( Turkish Characters )
本文介绍了PHP MYSQL 编码问题(土耳其语字符)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
core.php
$con=mysqli_connect("localhost","root","","mmogezgini");
header('Content-Type: text/html; charset=utf-8');
gamelisti.php
gamelisti.php
$result = mysqli_query($con,"SELECT * FROM games");
while($row = mysqli_fetch_array($result))
{
?>
HTML CODES
<?php echo $row['game_name']; ?>
HTML CODES
<?php }
mysqli_close($con);
?>
我使用土耳其语字符,如ö,ç,ğ,ı",我在数据库中正确看到这些字符,但是当我从数据库中选择它们并用 php echo 显示时,它们看起来像问号 =(?)我在数据库 utf8_general_ci 上的编码
i use turkish characters like "ö,ç,ğ,ı" i see these correctly in database but when i select them from database and show with php echo they looks like question mark=(?) my encoding on database utf8_general_ci
推荐答案
- 仔细检查您的 HTML 编码.
- http://php.net/manual/en/mysqli.set-charset.php(在你连接到数据库之后:
mysqli_set_charset($con, 'utf8');
- 您使用的是准备好的语句吗?(不相关但很重要).
- Double check your HTML encoding.
- http://php.net/manual/en/mysqli.set-charset.php (just after you connect to DB:
mysqli_set_charset($con, 'utf8');
- Are you using prepared statements? (not related but important).
这篇关于PHP MYSQL 编码问题(土耳其语字符)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文