Ask Php+mysql Chinese characters garbled problem, trouble everyone to mention suggestions
Web site with Php+mysql do, rented server is Linux, my page with the gb2312 character encoding, create data table with "Set names gb2312", the customer submitted the Chinese characters are not displayed, some garbled.
Want to know what I should set? (My site's customers are domestic, I would like to be able to add and display the normal Chinese)
Share to:
------Solution--------------------
Notice the difference between gb2312 and GBK.
GB2312 is a subset of GBK, which is not in the word.
The current browser and editor do not distinguish between the two, only recognize the previous GB
However, MySQL is strictly differentiated, and GBK characters that are not in gb2312 will not be processed correctly
Therefore, fields that may contain Chinese should be set to Gbk_chinese_ci or Utf8_general_ci
And after connecting to the database, execute the set names GBK directive
Note: The change in character set settings only works on subsequent data and does not affect the existing data in the table. Namely: The original garbled, is still garbled