Search code examples
phpcharacter-encodinginternationalization

php page not displaying arabic text


I have a PHP page where I am trying to display Arabic text but its showing.

In MySQL database I'm storing arabic text successfully.

I'm using the following code to connect to the database :

function connect(){
$this->dbLink = mysql_connect($this->dbHost,$this->dbUser,$this->dbPass);   
if(!$this->dbLink) die("Could not connect to database. " . mysql_error());
mysql_select_db($this->dbName);
mysql_set_charset("utf8", $this->dbLink); 
}

And using the following header in the PHP page :

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

But still no success.

Thanks for helping.


Solution

  • You can use this meta code:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    

    And please check mysql column's character type..

    Look to this