i tried entering Arabic text and insert it into mysql database using php, when print the row, all rows that in arabic looks like :
???? ???? ???? ????? ابو نصير عمان الاردن الاردن بببببببببببببببببب
i set my database to: Character set: utf8 -- UTF-8 Unicode Collation: utf8_general_ci
and every field in database: Character set: utf8 Collation: utf8_general_ci
i need to solve this problem and i appreciate all answers ..
To save an Arabic text into your MySql database table, you first check the table column is set to "utf8" or not. If not, switch to table structure tab of phpmyadmin and click change under action column, here you will see a column "Collation" and choose "utf8_general_ci" from utf8 group and save.
For the field to be able to store unicode characters, you have to use the type nvarchar (or other similar like ntext , nchar ). To insert the unicode characters in the database you have to send the text as unicode by using a parameter type like nvarchar / SqlDbType. NVarChar .
The MySQL database should just support Arabic letters. Especially if you tested this on your own computer with the same charsets and stuff, it should just work. phpMyAdmin on the other hand does have trouble with unicode characters.
Do the following:
Include the following query in every page of your application mysql_query("SET NAMES 'utf8'");
Be assured that your web pages are utf-8 encoded by the following meta tag:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With