0

I am working on parsing a HTML of website and saving information to database but in the website, there are Non English character (like Chinese, Indian, Korean, etc) that should be saved into MySQL. My problem is that in MySQL (when i view those information using PHP MyAdmin), it displays weird characters.

İlginç Gerçekler
ê³µì—°ì •ë³´ PARTI(ì—°ê·¹,콘서트,뮤지컬,오í...
ì •ì‹ ì—°ë ¹ 테스트

How to properly save these information to database?

Naftali
  • 144,921
  • 39
  • 244
  • 303
silent_coder14
  • 583
  • 2
  • 10
  • 38

4 Answers4

4

try using

mysql_query("SET NAMES 'UTF8'");

after mysql_connect or mysql_select_db. I use that for Turkish mysql_query("SET NAMES 'latin5'");

koala12
  • 56
  • 2
0

First of all make sure that the Table and Row Encoding is UTF-8 Formated. Next you should save the PHP Script file as UTF-8 Encoded With or Without BOM.

Or you can try using htmlspecialchars(); function to do that.

Rosmarine Popcorn
  • 10,761
  • 11
  • 59
  • 89
0

You must convert your insertion and/or tables to another coding style. Here you are how: http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html

elvenbyte
  • 776
  • 1
  • 17
  • 34
0

change your table collation to utf8

$con=mysql_connect("hostname","username","password");

mysql_query("SET CHARACTER SET utf8",$con);

check also this post

Community
  • 1
  • 1
Alireza
  • 1,428
  • 4
  • 21
  • 33