Under the Linux construction site, garbled problem bothered me for almost one weeks, and then finally resolved.
My experience is that the application must conform to the character set (encoding) of the database.
Specifically, that is, if you want to use gb2312 encoding, it is necessary to ensure that each JSP file is stored in gb2312 encoding (select GB2312 encoding when you save the file), in addition, the file header is defined; For databases, you define encodings when you create a database, for example: Create DATABASE MySQL default character set gb2312 collate gb2312_chinese_ci; the last thing to do is, when connecting data, add the following code to the related file:
useunicode=true&characterencoding=gb2312.
To add that is, in the Linux, in fact, do not choose gb2312, I have used is utf8, of course, also need to follow the above steps to set up, will not appear garbled! Personal preferences, we feel free!
Before I tried a lot of methods, such as in the/etc/sysconfig/i18n file to change the system font, in the/ETC/MY.CNF [mysqld] field after adding the following statement default-character-set=gb2312 and so on, I think there is no need.
The above steps seem very simple, but my failure lesson is also my success experience. Now share with you, look after the harvest, not the top is your unkind!
Forget, there is also a key point, JDBC must use the appropriate version, before I used the 3.0.9, found no, and then replaced 3.0.16, no problem.