Skip navigation links

MySQL Forums :: Character Sets, Collation, Unicode :: Arabic Text and Mysql and PHP


Advanced Search

Arabic Text and Mysql and PHP
Posted by: Ibrahim Khalil ()
Date: May 09, 2008 05:21PM

Hello All!

To read ,write and sort Arabic text in mysql database using php correctly, make sure that:

1- MySQL charset: UTF-8 Unicode (utf8)
2- MySQL connection collation: utf8_general_ci
3- your database and table collations are set to: utf8_general_ci or utf8_unicode_ci

Then, add this code in your php script when you connect to db:

mysql_query("SET NAMES 'utf8'");
mysql_query('SET CHARACTER SET utf8');

for more details:
http://www.adviesenzo.nl/examples/php_mysql_charset_fix/

I have tested it and it works well, I hope that would be helpful..

thanks!



Edited 2 time(s). Last edit at 05/09/2008 05:34PM by Ibrahim Khalil.

Options: ReplyQuote


Subject Views Written By Posted
Arabic Text and Mysql and PHP 33455 Ibrahim Khalil 05/09/2008 05:21PM
Translation: Arabic Text and Mysql and PHP 7316 Ibrahim Khalil 05/09/2008 05:28PM
Re: Arabic Text and Mysql and PHP 4450 Nader Morkus 05/24/2008 03:34PM
Re: Arabic Text and Mysql and PHP 3299 Muthu kumat 04/29/2009 03:27AM
Re: Arabic Text and Mysql and PHP 3005 Abdullah Khalifah 07/23/2009 09:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.