Problem description: When inserting Chinese characters into MySQL, or Chinese characters are displayed normally in MySQL, but jsp displays Chinese characters in MySQL in the foreground, it is garbled. Solution: Enter the mysql console and execute the following command: SET character_set_client='utf8'; SET character_set_connection='utf8'; SET character_set_results='utf8'; More solutions:
The CMD client input uses GBK encoding, while the database encoding format is UTF-8. The inconsistent encoding results in garbled characters. The current encoding format of the CMD client cannot be modified, so you can only modify the encoding set of connection, client, and results to inform the server that the currently inserted data uses GBK encoding. Although the server database uses UTF-8 encoding, it can recognize the GBK encoded data notified to the server and automatically convert it to UTF-8 for storage. You can use the following statement to quickly set the encoding set related to the client: After the settings are completed, the garbled problem of data inserted or displayed on the client can be solved, but we will soon find that this form of setting is only valid in the current window. When the window is closed and the CMD client is reopened, the garbled problem will appear again; so, how to make a once-and-for-all setting? There is a my.ini configuration file in the MySQL installation directory. By modifying this configuration file, the garbled character problem can be solved once and for all. In this configuration file, [mysql] is related to the client configuration, and [mysqld] is related to the server configuration. The default configuration is as follows: [mysql] default-character-set=utf8 [mysqld] character-set-server=utf8 At this time, you only need to change the default encoding default-character-set=utf8 to default-character-set=gbk and restart the MySQL service. This is the end of this article on how to solve the MySQL insert garbled problem. For more information on how to solve the MySQL insert garbled problem, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: JavaScript to achieve mouse tailing effect
>>: Implementing simple tabs with js
1. List The list ul container is loaded with a fo...
This article example shares the specific code of ...
mysql returns Boolean type In the first case, ret...
This article example shares the specific code of ...
Table of contents 1. exists 1.1 Description 1.2 E...
I have been playing around with charts for a whil...
Preface There are a lot of information and method...
When developing for mobile devices, you often enc...
Preface In the Linux kernel, in order to be compa...
If you are using Alibaba Cloud Server, you need t...
The implementation principle of chain programming...
Configuring Alibaba Cloud Docker Container Servic...
CSS background image flickering bug in IE6 (backg...
1. What is In react applications, event names are...
introduction: Nowadays, many dynamic verification...