Please ask Php+mysql Chinese characters garbled related problems, trouble everyone to mention suggestions

Source: Internet
Author: User
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

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.