PHP & MySQL Charset Issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
daredevil14
Forum Newbie
Posts: 2
Joined: Tue Nov 25, 2008 6:28 am

PHP & MySQL Charset Issue

Post by daredevil14 »

Hello,

i have a database that contains arabic data, note that its default charset is UTF8, the default collation is UTF8 too, and when querying doing this :

Code: Select all

mysql_query("SET NAMES 'UTF8'"); 
mysql_query('SET CHARACTER SET UTF8');
and the page that outputs data is set to UTF8

My problem is when entering data from an HTML form to the MySQL db ( note that it is done through AJAX, and the charset of the ajax script is UTF8 too )
when the new arabic data are inserted, they look like "%u0646%u0645" both in the database and in the HTML page, now i tried to use the above php script when querying the insert of the new data but nothing worked...

So what's the problem ?
daredevil14
Forum Newbie
Posts: 2
Joined: Tue Nov 25, 2008 6:28 am

Re: PHP & MySQL Charset Issue

Post by daredevil14 »

any help?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: PHP & MySQL Charset Issue

Post by Eran »

you need to provide more details, such as the code the outputs the text and the markup of the html page.
Post Reply