first, set the MyEclipse character encoding, the steps are as follows:1. Enter window--preferences--general--workspace,text file encoding option to change the default (GBK) option to other and set the value to Utf-8;
2, enter Window--preferences--myeclipse--files and Editors, will this option below: ASP and PHP, CSS, DTD, HTML, JSP, XML character encoding all changed to Utf-8;
3, if necessary, all the JSP page header is added this line of code: <%request.setcharacterencoding ("UTF-8");%> prevent the page from passing the value of the time garbled;4. If there is a call to the servlet file, add the following two lines of code to the servlet file:request.setcharacterencoding ("UTF-8");
Response.setcharacterencoding ("UTF-8");
Second, set the MySQL character encoding, need to close the MySQL service, whether the result is the first time to modify the manuscript, the second time there is a duplicate garbled problem:
Modify the encoding in My.init to GBK as follows (must be GBK if the UTF8 database will not be able to insert Chinese data gb2312 also not)
What to modify:
DEFAULT-CHARACTER-SET=GBK
Third, the configuration file modification scheme:
Modification scheme for XML configuration file:
<property name= "Connection.url" >jdbc:mysql://localhost:3306/yinhang?useUnicode=true& Characterencoding=gbk</property>
Modification scheme for Properties property file:
#hibernate. Connection.url JDBC:MYSQL://LOCALHOST:3306/YINHANG?USEUNICODE=TRUE&CHARACTERENCODING=GBK