How to add Chinese character data to MySQL using PHP

Source: Internet
Author: User
In general, MySQL does not use the Chinese character set by default during installation. If you want to use the Chinese character data, there are two ways. One is to specify the Chinese character set during installation.

In general, MySQL does not use the Chinese character set by default during installation. If you want to use the Chinese character data, there are two ways. One is to specify the Chinese character set during installation.

In general, MySQL does not use the Chinese character set by default during installation. If you want to use Chinese character data, there are two ways. One is to specify the use of the Chinese character set during installation, if MySQL has been installed, you can configure MySQL to support Chinese characters.

To use php to support Chinese character data during MySQL operations, first, we need to see what types of Chinese character sets our system supports. php document, and then save it as. We can see the supported Chinese Character Set in the format. We use the UTF-8 + BOM character set, and the rest of the work is how to set it. In the process of setting, you must first use MySQL_query ("set names utf8 + BOM"); To send commands to MySQL and tell MySQL the character set we want to use, then all php files need to be saved in UTF-8 + BOM format, so that you can use php to add Chinese character data to MySQL. However, there is a drawback that the Chinese character data in MySQL is garbled, but it can be read and written normally. UTF-8 is generally recommended on the Internet, but a problem occurs when such a format is used for display. I did not conduct any in-depth research, but only proposed a solution.

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.