Reasons and solutions for saving Chinese garbled characters in MySQL

Source: Internet
Author: User
Tags php mysql mysql import
Reasons and solutions for saving Chinese garbled characters in MySQL (the first classic domestic version ). When you encounter the problem of saving Chinese garbled characters in mysql, we look forward to finding the reasons and solutions for saving Chinese garbled characters in mysql (the first classic domestic version) how exciting this article is to solve the problem. Maybe 30% of programmers chose Baidu.

Reasons and solutions for saving Chinese garbled characters in MySQL (the first classic domestic version ). When you encounter the problem of saving Chinese garbled characters in mysql, we look forward to finding the reasons and solutions for saving Chinese garbled characters in mysql (the first classic domestic version) how exciting this article is to solve the problem. Maybe 30% of programmers chose Baidu.

Reasons and solutions for saving Chinese garbled characters in MySQL (the first classic domestic version ).

When you encounter the problem of saving Chinese garbled characters in mysql, we look forward to finding the reasons and solutions for saving Chinese garbled characters in mysql (the first classic domestic version) how exciting this article is to solve the problem.

Maybe 30% of programmers choose Baidu, the results showed that the user had posted a lot similar to "mysql Chinese Garbled text", "php mysql Chinese Garbled text", "mysql5.5 Chinese Garbled text", "mysql Garbled text", "mysql Garbled text", and "mysql jsp garbled characters, mysql jdbc garbled characters, mysql query garbled characters, and mysql import data garbled characters, which of the following solutions can solve your own problems? 15% of the programmers will be overwhelmed at a glance, and 15% of the remaining programmers will explore or ask for help. 70% of programmers simply don't do it. If you can't do it, you can still do it as a programmer. This kind of waste of life allows others to do it.

In fact, the problem of garbled mysql is complicated and very responsible. It is not easy to say! The difference lies in understanding the essential cause of mysql Garbled text. This article aims to let programmers master how to deal with this Garbled text.

(1) website code. That's not much to say. Let's see if the settings are correct. For example, if I set the GBK, I will check whether the encoding is GBK. (Generally, you can right-click a file or set it when creating a project)

(2) encoding of the database connection string. For example, the statements related to mysql connection in java are as follows:

Public static String driverName = "com. mysql. jdbc. Driver ";
Public static String userName = "root ";
Public static String userpassswd = "123456 ";
Public static String dbName = "myBook ";
Public static String url = "jdbc: mysql: // localhost/" + dbName + "? User ="
+ UserName + "& password =" + userPasswd
+ "& UseUnicode = true & characterEncoding = GBK ";



.....

Class. forName (driverName). newInstance ();
Connection = (Connection) DriverManager. getConnection (url );

In the above Code, bold is what I want to talk about. You can set the desired string type. Here we set GBK, which is just an example of the java language, the principles of asp and php in other languages are the same. There are such database string links about character set configuration. You won't check the manual or Baidu. This is easy to find. If Baidu still cannot find it, that's right, too.

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.