Develope Bangla Unicode based Web Application using PHP-MySQL
1 .Make the database and Tables with CHARACTER utf8 and collation_connection =’utf8_general_ci’
2 . Must add following two lines just after selecting the database, i.e mysql_select_db() function:
mysql_query(’SET CHARACTER SET utf8′);
mysql_query(”SET SESSION collation_connection =’utf8_general_ci’”);
4 . Set the META-TAG as “Content-Type: text/html; charset=UTF-8″
Here is a sample page what will show data from database:
<?
header(’Content-Type: text/html; charset=UTF-8′); //As its php page i dont need the meta-tag so i need to send a header .
mysql_connect(’localhost’,'xxxxx’,'xxxxxx’) or die(’Error In connection’);
mysql_select_db(’test’) or die(’Error In connection(DB)’);
mysql_query(’SET CHARACTER SET utf8′);
mysql_query(”SET SESSION collation_connection =’utf8_general_ci’”);
$queryTest = mysql_query(”SELECT * FROM test”) or die(’Query Problem’);
while($resultTest = @mysql_fetch_assoc($queryTest))
echo $resultTest['name'].PHP_EOL;
?>
Resources:
1. http://ranacse05.wordpress.com/2008/05/20/bangla-web-app/
2. http://hasin.wordpress.com/2006/07/18/storing-bangla-unicode-text-in-mys...
Recent comments