Question

I have a problem on reading Arabic language, when I read arabic text it displayed as a question marks like that

���� ����

Although my php page encoding as Utf8.

And all the table in my database collation Utf8_general_ci.

What should I do ?!!

Was it helpful?

Solution

you must set charset in first connect with mysql through this query:

SET CHARACTER SET utf8

for example in mysqli functions

$MySQL_Handle = mysqli_connect(HOSTNAME,DATABASE_USERNAME,DATABASE_PASSWORD,DATABASE_NAME) or die ( mysqli_error($MySQL_Handle) );

$sSQL= 'SET CHARACTER SET utf8';

mysqli_query($MySQL_Handle,$sSQL) or die ('Can\'t charset in DataBase');

this action need before insert and before select.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top