MySQL字符编码的最后一口气,奇怪的字符


last gasp with MySQL character encoding, strange characters

当我在phpMyAdmin中查看一个带有"ø"的单词时,我会正确地看到"ø",但当我被传递到我的html页面时,我看到了"。

我已经尝试了在stackoverflow和其他地方能找到的每一条建议(并阅读了"每个开发人员必须知道的最低限度…"这篇文章),但我似乎无法理解(下面的列表)。我错过了什么?

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

AddDefaultCharset UTF-8

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

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

当我在firefox中显示页面信息时,它说编码是utf-8。我所有的脚本都是用utf-8编码的页面编写的。

什么东西?我想不出其他事情可做了。有什么测试我可以运行吗?

感谢任何内部

当我遇到类似的问题时,只将MySQL数据库设置为UTF-16会有所帮助。也许这对你的情况也有帮助?

发现了我的问题。在显示之前,我在字符串上调用了html_entities。我是个白痴。谢谢你的帮助。现在显示良好。