Eclipse query MySQL, add Chinese garbled problem

Source: Internet
Author: User

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:


Third, the configuration file modification scheme:

Modification scheme for XML configuration file:

<property name= "Connection.url" >jdbc:mysql://localhost:3306/yinhang?useUnicode=true&amp; Characterencoding=gbk</property>

Modification scheme for Properties property file:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.