MySQL cannot recognize Korean characters

2019-02-28 20:44发布

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"]);

标签: php mysql encode
1条回答
一纸荒年 Trace。
2楼-- · 2019-02-28 21:11

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

查看更多
登录 后发表回答