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
83657
May 09, 2008 05:21PM
4685
April 29, 2009 03:27AM


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.