Unicode enable Site -this is how it is done


Hi,

today I try to make a site which support all characters set i.e. it is unicode enable So I go for this coding in PHP and it works fine for me to extract the data from mySql in unicode and than display the same in the Web Browser..

Put this in the HTML Head Section
<meta equiv=”content-type” content=”text/html; charset=UTF-8″>

And use this PHP Code to Extract the unicode from the Database
<?
$con=mysql_connect(“localhost”,”root”,””) or print(“DB connection fails”);
$db=mysql_select_db(“sumit_textbook”) or print(“DB db selection fails”);

$query=”SET NAMES ‘utf8’ “;
$result=mysql_query($query);
$query=”SET CHARACTER_SET ‘utf8′”;
$result=mysql_query($query);

$query=”select * from t_IndPerson”;
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
print_r($row);
}
?>

Hope it help unicode enable site developers in future… At least it help me out a lot..:o)

Bye
Sumit gupta