I recently opened up an old website of my own to a different webserver. I uploaded the database, the website files, checked the connections and everything is runnning smoothly. The only thing that i can't fix is that the greek language is displayed as
"????"
. Checked in database and everything is correct, the letters are showing and the coding is utf8. So i ended up thinking it is x-carts problem. What can i try to do? x-cart Version is 4.4.1.
You have to check these points:
1) You database.sql file to import is UTF-8. Greek symbols are readable in a text editor
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) every MySQL variable is UTF-8. Greek symbols are readable in a mysql client
[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 is UTF-8 on the ' Main page :: Edit languages :: Greek ' page
4) mysql_query("SET NAMES 'utf8'");
is added to the include/func/func.db.php file according to
https://help.x-cart.com/index.php?title=X-Cart:FAQs#How_do_I_set_up_my_X-Cart_to_support_UTF-8.3F