当我回显阿拉伯字符时,它们看起来很好,但如果我从数据库中回显它们,它们会显示为问号。这是我到目前为止所做的,但它仍然无法正常工作:
现在的字符集设置是:
| Variable_name | Value |
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
现在的排序规则设置是:
| Variable_name | Value |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
在我使用的 PHP 代码中:
header('Content-Type: text/html; charset=utf-8');
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
mysql_query("set character_set_server='utf-8'");
mysql_query("set_names 'utf8'");
更多信息: