I am trying to insert some Arabic Language data into MySQL using PHP and an HTML form. When I insert the data in to MYSQL table, the table field represents data as مرØبا العالم
.
But when I access the same data with PHP and show it in my webpage, it shows the correct data. I am using:
http-equiv="Content-Type" content="text/html; charset=utf-8"
meta
tag in my web page to show Arabic data. My question is why my data looks like this: مرØبا العالم
in MySQL table, and how should I correct it.
You have to do both of the following:
utf8_general_ci
(both for the field itself and the table as well as the database).Send two commands right after establishing a connection to the database:
mysql_query("SET NAMES utf8;");
mysql_query("SET CHARACTER_SET utf8;");