xnote
xnote

Reputation: 89

MySQL cannot recognize Korean characters

I need to insert korean text to my database which is coming by url get request. However, inserted values are not recognized in MySQL. Please, need quick instruction. Thanks.

setlocale(LC_CTYPE, 'ko_KR.utf8');
mb_internal_encoding("UTF-8");    
mb_http_output('utf-8');   

$p_text = rawurldecode($_GET["text"]);

Upvotes: 1

Views: 2390

Answers (1)

Mihai Matei
Mihai Matei

Reputation: 24276

Right after your mysql connection make this query

$mysqli->query("SET NAMES 'UTF8'");

or

mysql_query("SET NAMES 'UTF8'");

also make sure that your fields have utf8_general_ci collation

Upvotes: 5

Related Questions