Restore text from Mysql database in Other language rather than English

Restore text from Mysql database in Other language rather than English

In my case i have a website that have to support Farsi language and english. I restore a text data from database and  show in php pages.

After restore a data, if your page showing nonsense things, its very easy to solve it. you may use this command:

mysql_query(‘SET NAMES utf8’);

note that you may need to change your table “Collation” to utf8_general_ci, for this you can use the wizard or this command:

ALTER TABLE table_name COLLATE utf8_general_ci

even you can change the collate just for one column:

ALTER TABLE table-name ALTER COLUMN column_number  column_type  COLLATE utf8_general_ci

Leave a Comment

Your email address will not be published. Required fields are marked *