There is a data table on the line, the character set is UTF8, but because of the reason of the environment is not unified, causes the data table to actually store the content is the latin1 inside code the data.
In other words, the data of the latin1 character set is actually stored through the UTF8 shell.
In this case, you need to be aware of several character set configurations:
The Client Terminal tool (SECURECRT) displays the character set as: Utf-8,
Under Linux Terminal (term), set the lang environment variable to: en_US. UTF-8, or ZH_CN. UTF-8,
After connecting to MySQL, set the client/connect character set to: Latin1 (set names latin1).
When the above settings are completed, the Chinese will be displayed correctly in the MySQL CLI client on the Linux command line.
In order to unify, it is necessary to transfer the internal code of these data to UTF8, which can be done in the following steps:
Export the raw data with the latin1 character set, ensuring that the local client (Chinese environment) can be viewed normally with a text editor.
The text editor is saved as the Utf-8 character set after uploading to the server side or copying the data directly to
Linux terminal, create a new file, directly paste the data in,
Clear the data table (truncate), modify the character set (ALTER TABLE XX default charset = UTF8),
Imports text into a data table.
The above is a rather clumsy manual method to demonstrate the whole process.
If the table stores more complex data, it is recommended to write a program to convert, after all, the code is different, not directly online conversion.
--------------------------------------Split Line--------------------------------------
http://zhishuedu.comTraining is a professional quality training brand jointly launched by senior MySQL expert Ye Jinlong and Wu Bingxi, with MySQL dba combat optimization and Python devops Development course, which is the most conscientious and The most quality training courses.
This article is from the "Lao Ye teahouse" blog, please be sure to keep this source http://imysql.blog.51cto.com/1540006/1879765
FAQ Series | UTF8 Table store Latin1 garbled character conversion