Chinese characters cannot be inserted into database
This post was last edited by Kaixinmaitian on 2014-01-19 10:47:58
MySQL data is UTF8
Page format is: GB2312
Settings were made when joining the database: mysql_query ("Set names GB2312")
Normal display when reading database information, but "Chinese character field is blank and data field is normal" when adding record
If you use Iconv ("GB2312", "UTF-8", $keywords) the conversion of Chinese characters to UTF8 format and then increase the database is garbled, please expert guidance.
share to: more
------Solutions--------------------
1, confirm that the field to save the Chinese connection proofreading is utf8_general_ci, of course, GBK_GENERAL_CI is also possible
2, is mysql_query ("Set names GBK")
Instead of mysql_query ("Set names GB2312")
Because gb2312 word capacity is too small, GBK and Utf-8 peer
3, mysql_query ("Set names XXX") role is to inform MySQL: I want to use XXX code to pass the data
So it's absolutely wrong to make your own code conversion.