0

I'm trying to insert a Unicode message in my database.

+9195******** पर मुझे फोन

Its inserting like the below line.

+9195******** पर मà¥à¤à¥‡ फोन

Can anybody tell me how to overcome this issue ?

Rikesh
  • 25,621
  • 14
  • 77
  • 86
Radhakrishna Rayidi
  • 510
  • 2
  • 9
  • 24

2 Answers2

0

You need to change the table collation to UTF8

alter table *table_name* CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci
Jojo
  • 1,845
  • 3
  • 31
  • 28
Abedelhadi
  • 16
  • 1
0

Consider if this is the query,

  $test = "...SQL Query...";
  $result = mysql_query($test);

Just add this alone in above of $test

 $result = mysql_query("SET NAMES utf8");

Your final code should be,

 $result = mysql_query("SET NAMES utf8");
 $test = "...SQL Query...";
 $result = mysql_query($test);

Also, add this line at the top,

 header('Content-Type: text/html; charset=utf-8');
Yuva Raj
  • 3,850
  • 1
  • 18
  • 30