In MySQL, the corresponding table field encoding is usually the default lartin1 encoding, in the local client when the display is garbled, but through the mysql-u-p-h command login, select query to the data is normal, through JDBC or PHP, etc. to fetch back the Chinese is garbled;
That is, Chinese in MySQL is lartin1, to our own local or with Navicat and other select is garbled, using the MySQL built-in function to convert
SELECT Convert (Unhex (hex (convert name using latin1)) using UTF8) as name from test
The above statement means that, in table test, the field name is encoded as a lartin1 query and the result is converted to UTF8 encoded result
PS (Spit groove!!!): See a lot of people also through the JDBC query when the set names Lartin1, but also the new String (rs.getstring ("Samplecolumnname"). GetBytes (" Iso-8859-1 ")," UTF-8 "), pulled a lot of, the final result is still garbled, hairy with, a MySQL built-in function is done, it is easy to understand.
MySQL latin1 encoded in Chinese to UTF8