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 ?

有帮助吗?

解决方案

You need to change the table collation to UTF8

alter table *table_name* CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci

其他提示

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');
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top