Topic: How to fetch unicode character from MySQL?

Some days ago i tried to fetch some posts from a punBB database. the value was in bangla. when i fetched them, the character was like ???? sign. Then i used htmlspecialchars() and also htmlentities() function. But the result was same. So how to fetch them properly? i need help please

http://tareq.wedevs.com/test/sig/blog_update.php
http://tareq.wedevs.com/test/sig/twitt_update.php

Re: How to fetch unicode character from MySQL?

//Tareq

Some days ago i tried to fetch some posts from a punBB database. the value was in bangla. ...................




hellow tareq...

    I think i can help you.first you have to change ur "meta" tag in html form.
    paste the following code :

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

Now you have to add two more lines in your punBB php code just after database connection:

mysql_query('SET CHARACTER SET utf8');
mysql_query("SET SESSION collation_connection='utf8_general_ci'") or die (sql_error());

go to phpmyadmin and change your database and tables to "utf8_general_ci";

Now you can fetch data in any way..

I think thats all.....see what happens and let me know the result...................thankxxxxx

Galib

Re: How to fetch unicode character from MySQL?

I used the two mysql_query function and It really works. Thanks thumbs_up

http://tareq.wedevs.com/test/sig/blog_update.php
http://tareq.wedevs.com/test/sig/twitt_update.php

Re: How to fetch unicode character from MySQL?

Hmmm.bt when u use simple html form u have2chng the meta.otherwise u cant retrive long data & phpmyadmin may show u some ascii values!!!!!!!:p

Galib

Re: How to fetch unicode character from MySQL?

I used the both queries, but still had some problems. When i use the unicode variables, when passing them to other queries, i got some problems. Then i used

mysql_query("set names 'utf8'");

with replacing

mysql_query('SET CHARACTER SET utf8');
mysql_query("SET SESSION collation_connection='utf8_general_ci'") or die (sql_error());

and they worked fine smile

http://tareq.wedevs.com/test/sig/blog_update.php
http://tareq.wedevs.com/test/sig/twitt_update.php