In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the mysql jsp garbled code how to do, the article introduced in great detail, has a certain reference value, interested friends must read it!
Mysql jsp garbled solutions: 1, use "show variables like 'character%';" to view the current database related code set; 2, through "set names gbk;" to set the client-related code set.
This article operating environment: windows7 system, mysql5.5 version, Dell G3 computer.
The solution to the problem of Chinese garbled code when inserting data into the MySQL of JSP
When inserting a piece of data such as insert into employee values with Chinese into the MySQL database (null,' Zhang San', 'female','1995-10-08', 'female','1995-10-08' is a good employee!) When garbled occurs, you can use the statement show variables like 'character%'; to view the relevant code set of the current database.
From the figure above, you can see that MySQL uses six character sets: client, connection, database, results, server, and system. It is related to the server side: database, server, system (which can never be modified, that is, utf-8); related to the client side: connection, client, results.
After understanding the above information, let's analyze the causes of garbled codes. The problem lies in the current CMD client window, because the current CMD client input uses GBK encoding, while the database encoding format is UTF-8, resulting in garbled codes due to inconsistent coding. However, the coding format of the current CMD client can not be modified, so we can only modify the coding set of connection, client and results to tell the server that the data currently inserted is encoded by GBK. Although the database of the server uses UTF-8 coding, it can identify the GBK encoded data of the notification server and automatically convert it into UTF-8 for storage. You can use the following statement to quickly set the client-related code set:
Set names gbk
After the setting is completed, you can solve the problem of garbled code when the client inserts or displays data, but we will soon find that this form of setting will only be valid in the current window, and there will be garbled problem when the CMD client is reopened after the window is closed; so, how to make a setting once and for all? There is a my.ini configuration file in the MySQL installation directory, and the garbled problem can be solved once and for all by modifying this configuration file. 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 point, you only need to change the default encoding default-character-set=utf8 to default-character-set=gbk, and restart the MySQL service.
The above is all the contents of the article "what to do about jsp garbled in mysql". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.