开发者

Why do i have to use set_charset("utf8") even though everything is utf-8 encoded? (MySQLi-PHP)

My table's collation is utf8_general_ci.

My pages are encoded with UTF-8 (without BOM).

Within my pages, my Equiv meta tag sets character set to utf8

My data has Turkish characters in it.

When i output them, it's not showing them as it should be but when i do 开发者_开发问答$db->set_charset("utf8");, it works.

Why do i have to use $db->set_charset("utf8"); even though everything is utf-8 encoded?


The data is stored as UTF-8 in MySQL, but the PHP's client connection collation is not. Which is why you have to use set_charset in PHP for the DB connection.

Update

php.ini : default_charset utf-8
.htaccess : AddDefaultCharset utf-8

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜