为什么我必须使用mb_convert_encoding($ name,'ISO-8859-15','utf-8')来获得重音字符显示? [英] why do i have to use mb_convert_encoding($name,'ISO-8859-15','utf-8') to get accented chars to display?
问题描述
我已经设置了我的数据库和字段来使用utf8_general_ci
现在无论什么原因,我必须在变量上使用以下代码,以便在数据库中正确显示重音字符:
mb_convert_encoding($的名字, 'ISO-8859-15', 'UTF-8');
这对我来说没有意义。当phpmyadmin在utf8中时,为什么要将其转换为ISO-8859-15,数据在utf8中,数据库和表字段位于utf8?
您最有可能没有将数据库连接设置为UTF-8,因此您的数据库期望您发送ISO-8859编码数据。请参阅 http://dev.mysql.com/doc/refman/ 5.0 / en / charset-connection.html
the data im working with here is off of a page that uses utf8 encoding
i've set my database and fields to use utf8_general_ci
now for whatever reason, i have to use the following code on the variable in order to have it display accented characters correctly in the database:
mb_convert_encoding($name,'ISO-8859-15','utf-8');
this makes no sense to me. why do i have to convert it to ISO-8859-15 when phpmyadmin is in utf8, the data is in utf8, and the database and table fields are in utf8?
You most likely have not set your database connection to UTF-8, so your database expects you to send ISO-8859 encoded data. See http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html
这篇关于为什么我必须使用mb_convert_encoding($ name,'ISO-8859-15','utf-8')来获得重音字符显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!