문제

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