我最近打开了一个自己的旧网站到另一个网络服务器。我上传了数据库,网站文件,检查了连接,一切都顺利运行。 我无法解决的唯一问题是希腊语言显示为
" ????"
。检查数据库,一切正确,字母显示,编码为utf8。所以我最终认为这是x-carts的问题。我该怎么办? x-cart版本是4.4.1。
答案 0 :(得分:1)
你必须检查以下几点:
1)您要导入的database.sql文件是UTF-8。希腊符号在文本编辑器中是可读的
aim-server[~/tmp]$ file -ib database.sql
text/plain; charset=utf-8
aim-server[~/tmp]$ grep ελληνικά database.sql
INSERT INTO `xcart_languages` VALUES ('el','lbl_categories','Categories ελληνικά','Labels');
aim-server[~/tmp]$
2)每个MySQL变量都是UTF-8。希腊符号在mysql客户端中是可读的
[aim_xcart_4_4_1_gold]>show variables like '%colla%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0,00 sec)
[aim_xcart_4_4_1_gold]>show variables like '%char%'; +--------------------------+----------------------------+
| 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/ |
+--------------------------+----------------------------+
8 rows in set (0,00 sec)
[aim_xcart_4_4_1_gold]>select * from xcart_languages where name='lbl_categories';
+------+----------------+-----------------------------+--------+
| code | name | value | topic |
+------+----------------+-----------------------------+--------+
| en | lbl_categories | Categories ελληνικά | Labels |
3)Charset在'上是UTF-8。主页::编辑语言::希腊语'页
4)根据mysql_query("SET NAMES 'utf8'");
添加到include / func / func.db.php文件中
https://help.x-cart.com/index.php?title=X-Cart:FAQs#How_do_I_set_up_my_X-Cart_to_support_UTF-8.3F