[英]last gasp with MySQL character encoding, strange characters
When I view a word with an "ø" in it in phpMyAdmin, I see the "ø" correctly, but when i gets delivered to my html page, I see "ø". 当我在phpMyAdmin中查看带有“ø”的单词时,可以正确看到“ø”,但是当我将其传递到html页面时,则看到“Ô。
I have tried every bt of advice I can find on stackoverflow and everywhere else (and read the article "the bare minimum every developer must know...", but I can't seem to figure this out (list below). What am I missing? 我已经尝试了我在stackoverflow以及其他所有地方都能找到的所有建议(并阅读了文章“每个开发人员必须知道的最低限度...”,但我似乎无法弄清楚(下面列出)。我想念吗?
Mysql: MySQL的:
mysql_query("SET character_set_results = 'utf8'");
mysql_query("SET character_set_client = 'utf8'");
mysql_query("SET character_set_connection = 'utf8'");
mysql_query("SET character_set_database = 'utf8'");
mysql_query("SET character_set_server = 'utf8'");
mysql_query("SET NAMES UTF8");
.htaccess .htaccess
AddDefaultCharset UTF-8
PHP: PHP:
declare(encoding='UTF-8');
ini_set('default_charset', 'utf-8');
header('Content-Type: text/html; charset=utf-8');
header('Accept-Charset: utf-8');
header('Accept: text/html');
mb_language('uni');
mb_internal_encoding('UTF-8');
iconv_set_encoding("input_encoding", "utf-8");
iconv_set_encoding("internal_encoding", "utf-8");
iconv_set_encoding("output_encoding", "utf-8");
HTML 的HTML
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
When I show page info in firefox, it says encoding is utf-8. 当我在firefox中显示页面信息时,它表示编码为utf-8。 All of my scripts are written in utf-8 encoded pages.
我所有的脚本都是用utf-8编码的页面编写的。
What gives? 是什么赋予了? I can't think of anything else to do.
我想不出其他办法。 Are there some tests i can run?
我可以进行一些测试吗?
Thanks for any insi 谢谢你的帮助
When I've had similar problem, only setting the MySQL database to UTF-16 helped. 当我遇到类似的问题时,仅将MySQL数据库设置为UTF-16会有所帮助。 Maybe it will help in your case too?
也许这也会对您有帮助吗?
found my problem. 发现我的问题。 I was calling html_entities on the string before showing it.
在显示字符串之前,我曾在字符串上调用html_entities。 I'm an idiot.
我是个白痴。 Thanks for your help.
谢谢你的帮助。 Shows fine now.
现在显示正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.