Solve the two misunderstandings of MySQL Chinese garbled characters in C # operations

Source: Internet
Author: User

The following articles mainly introduce the two misunderstandings in the C # operation regarding the MySQL Chinese garbled solution, and the specific description of the correct solution for MySQL Chinese garbled characters in C # operations. The following is the detailed description of the article.

C # misunderstanding of the solution for operating MySQL with Chinese garbled characters:

In the past few days, the optional encoding methods for searching online resources are: gb2312, gbk, and utf8 support dual-byte encoding types. This is not the case in actual experiments.

C # misunderstanding of the solution for operating MySQL with Chinese garbled characters: one of them is that we all want to use utf8, but UTF8 is not ideal in Chinese processing, select/Update/Insert are garbled;

C # misunderstanding of the solution for operating MySQL Chinese garbled characters: 2. gbk character set is much larger than gb2312, which is the second preferred character set, but after the Server/Database is set to GBK character set, the connection fails in the Program (not support), not to mention the operation;

C # final solution for operating MySQL Chinese garbled solutions:

1. gb2312 Encoding

2. Set the default encoding in the my. ini file.

Add or modify default_charater_set = gb2312 in the [optimal combination of MySQL (and PHP)] and [optimal combination of MySQL (and PHP) d] configuration segments.

3. When creating a database, use gb2312 encoding.

4. When creating a table, use gb2312 encoding and gb2312_chines_ci for Collation (gb2312_bin is not tested)

5. Set the encoding for specific fields that need to store Chinese characters using gb2312 and gb2312_chines_ci for Collation (gb2312_bin is not tested)

The above content is an introduction to the final solution of the MySQL Chinese garbled solution for C # operations. I hope you will gain some benefits.

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.