Jsp fetch data from mysql-Chinese display problem

Source: Internet
Author: User

The key to Chinese display is to identify at which stage the problem arises;

When obtaining data submitted by a jsp form:

Filter can be configured in web. xml (before struts filter must be configured)

<! -- Solve Chinese garbled characters -->
<Filter>
<Filter-name> encodingFilter </filter-name>
<Filter-class> org. springframework. web. filter. CharacterEncodingFilter </filter-class>
<Init-param>
<Param-name> encoding </param-name>
<Param-value> GBK </param-value>
</Init-param>
</Filter>
 
<Filter-mapping>
<Filter-name> encodingFilter </filter-name>
<Url-pattern>/* </url-pattern>
</Filter-mapping>
<! -- **************************** -->

 

Question about retrieving data from the mysql database:

I used mysql5.0.22. I don't know how to set the default character encoding in the command line window. Some methods on the Internet still won't work, and it won't work even after more than half a day;

 

Finally, I got the latest mysql 5.5.21.0 version on the official website. I created a database in workbench to create a table, set the character encoding, and finally file --> export --> forword engineer SQL create script ..

 

Execute the automatically generated SQL statement in the client command line window;

 

Success: the Chinese is displayed normally.

 

From the column Test_LD

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: info-contact@alibabacloud.com 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.