0

I am using a magazine name listing program using php. Here I used to manipulate different languages.

I am inserting magazine name into a table. The field name is

 tbl_magazine field type - varchar(32 collation utf8_general_ci 

when I insert different languages into the table [using google translator]. This correctly inserted into my db [like this viewing in database সঙ্গে পরীক্ষা]. But when I retrieve this using php this record show as ????? like this.

If anyone know about this, please help me.

3
  • Can you show the code which retrieves it from database, and outputs it? Is your file encoded as utf-8? Also, is your webserver serving utf-8? Commented Mar 6, 2014 at 10:55
  • 1
    See UTF-8 all the way through. Commented Mar 6, 2014 at 10:59
  • If you're sure database is dealing right with the text, you need to post the string in codes to examine what's happening. Commented Mar 6, 2014 at 21:26

4 Answers 4

1

Set your database connection to UTF8:

mysql_query("SET CHARACTER SET UTF-8", $conn); mysql_query("SET NAMES UTF-8", $conn); 

Also ensure your HTTP responses are interpreted as UTF8:

header("Content-Type: text/html; charset=UTF-8"); 
Sign up to request clarification or add additional context in comments.

1 Comment

Who said the OP was using ext/mysql?
1

Try to use this code at top of your page,

mysql_query('SET character_set_results=utf8'); 

For more details, you can refer this tutorial, http://www.9lessons.info/2011/08/foreign-languages-using-mysql-and-php.html

1 Comment

Who said the OP was using ext/mysql?
0

first your db table must have utf8_general_ci collation

and place mysqli_set_charset ($con, "utf8"); after connection establish...

1 Comment

Who said the OP was using mysqli?
0

Try executing the following query before you retrieve data:

SET NAMES utf8 

It should help.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.