954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

inserting arabic characters into mysql

Hello,

I have looked everywhere on the web for a solution to this problem.

I am trying to store arabic characters into mysql via an html form.

i have set the meta charset to utf-8 and have tried mysql_query('set names 'utf=8'")

but still i get garbled characters in my table:

لربيلبي

Please advise!

roy--
Light Poster
25 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 
fatihpiristine
Posting Whiz in Training
283 posts since Sep 2007
Reputation Points: 6
Solved Threads: 19
 

thanks faith but that didnt help with my problem.

:/

roy--
Light Poster
25 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

did you try ansi_unicode_?

fatihpiristine
Posting Whiz in Training
283 posts since Sep 2007
Reputation Points: 6
Solved Threads: 19
 

i have something like this
i insert data into db
in the db the data is not readable
but when select it on a php page
everything goes well
so the application is running anyway

w_3rabi
Junior Poster
160 posts since Dec 2006
Reputation Points: 18
Solved Threads: 9
 

is it local or remote located database?
if locale chech my.ini, find default charset and change it to ansi_unicode
collation in the same way.

fatihpiristine
Posting Whiz in Training
283 posts since Sep 2007
Reputation Points: 6
Solved Threads: 19
 

Got it working!

mysql_query("set names 'utf8'");

Thanks everyone for your replies..

roy--
Light Poster
25 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

I Have same problem...
It is solved also when I put
mysql_query(

Lotus-Sy
Newbie Poster
1 post since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

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!

almounkez
Newbie Poster
1 post since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

hey i was have this problem for two days and i have found the solution .. you have to add this code
accept-charset="utf-8"
to your forum

wafa@
Newbie Poster
1 post since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You