Mysql5 insertion garbled problem in the database upgraded from 4.2 to 5.1.6-comm... latin1 is followed by the default encoding. Chinese characters are garbled in previous programs. The previous method is to add charset = gb2312 to source, and then execute set names gb2312 before insertion; I have found many articles on the Internet, except for the above writing, that is, directly changing the database settings. However, this database is a product bought by someone else, so I have to write articles on the code, after tossing for a long time, come to the following conclusions to share with you, latin1 is the iso8859-1, so before inserting the need to convert the content to the iso8859-1, as follows: Encoding iso88591 = Encoding. getEncoding ("iso8859-1"); Encoding df = Encoding. default; byte [] gb2312bytes = df. getBytes (content); // byte [] asciiBytes = Encoding. convert (df, iso88591, gb2312bytes); tring str = iso88591.GetString (gb2312bytes); after this conversion, the charset parameter is not added to the source, and the set names ** is not required in the program **, the data can be inserted normally.