0

I have a database field with utf8_unicode_ci encoding in MySQL. This arrangements done by the previous developer and it's store arabic language data in some special character format like this:

رنا كلبونه

I have set the headers to <meta http-equiv="Content-type" value="text/html; charset=utf-8" /> but its not showing the arabic language characters when I try to fetch the values from the database. It's only showing these special characters instead of the language.

mudit mehrotra
  • 71
  • 1
  • 11
  • Search for "Mojibake" in http://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James Nov 13 '16 at 17:07

1 Answers1

1

If you are using MySQL then use below after DB connection

mysql_query("SET NAMES utf8");

If you are using MySQLi then use below after DB connection

mysqli_set_charset($connection,"utf8");

If you are using class and object of mysqli then use below

$mysqli = new mysqli("localhost", "root", "", "test");
$mysqli->set_charset("utf8");

Hope this will help !

Jay Gosai
  • 279
  • 1
  • 11
  • Thanks for the comment. I am using the codeigniter and `dbcollact = latin1_swedish_ci` and `char_set = latin1` worked for me. – mudit mehrotra Nov 14 '16 at 10:12