In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you mysql individual text garbled how to do, I hope you will learn a lot after reading this article, let's discuss it together!
Mysql individual text garbled solution: first open the server\ MySQL folder, then open the my.ini file, and finally add the code "character_set_server=gbk".
The problem of individual characters garbled in MySQL database of java website
The problem of garbled code is a headache, especially a very small amount of garbled code. Here to share a personal development process encountered in a garbled problem, I hope it can be helpful to everyone.
Methods / steps
Check the location of the garbled code-the front desk.
Here the editor examines the foreground jsp page through the firebug tool of Firefox and finds that post is indeed utf8 data. Therefore, the garbled code is eliminated when the foreground transmits the data.
Check the location of the garbled code-- the background.
Because colleagues use the struts formbean way to receive foreground data, the editor doesn't know much about it, so he uses a stupid method: find the data transfer process that produces garbled code, add an output to each method passed in the process, and view the output data in the background.
As a result, these figures are also normal.
Check the location of the garbled code-- MySQL database.
When the foreground and background are excluded, then only the database is left. Then the problem lies in the database.
The editor first directly data the garbled Chinese characters in the database and finds that they can be stored. The problem of text coding of database tables is eliminated.
After that, the editor made a query in the tool software (sentence: show variables like'% char%';), and the result is as follows. The problem was suddenly discovered: because the Chinese characters in gb2312 are not complete, so some Chinese characters are not encoded, and these Chinese characters will be forced to be converted to "?" At this point, the data of this Chinese character is lost and cannot be restored.
Detailed explanation of the reasons:
There are actually several conversion procedures for data entry and exit of MySQL database.
When entering, character_set_ client transfers character _ set_ connection to character _ set_server and stores it in the database.
When it is taken out: the database is taken out and transferred to character_set_ server to character _ set_result.
So you should understand that the data in and out of the database have to be converted by character_set_server, so whether it is the correct Chinese characters in the foreground or the correct Chinese characters in the database, as long as they are not in the gb2312, they will be converted into question marks.
Solution:
Once and for all, the editor modifies the my.ini file directly in the server\ MySQL folder.
The modification process is to find [mysqld] and then look down a few lines to find "default_character_set=utf8", and add a line "character_set_server=gbk" under the line.
Of course, it is not necessary to use gbk, the editor is to be careful to use the national standard extension, that is, the extension of gb2312 gbk.
After reading this article, I believe you have a certain understanding of mysql individual text garbled how to do, want to know more related knowledge, welcome to follow the industry information channel, thank you for reading!
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.