Chinese garbled characters in JSP + SSH frameworks have been resolved

Source: Internet
Author: User

Made a system. The user_add.jsp page and the user_list.jsp page are displayed.

Add the chinese user name "I love you" and the password "123"

 

Garbled characters are displayed on the display page. An error occurred while displaying Chinese characters.

Troubleshooting:

1. Check the database and find that the written data is garbled.

Garbled characters may occur on the submission page.

Data with garbled characters directly in the database

Chinese characters are displayed in user_list.jsp.

Charset and pageencoding changed to Z support gb18030 or UTF-8, done

Add "I Love You" password 123 again

Show Chinese successfully

PS: Page default charset = ISO-8859-1, the following is an in-depth study

1. When the display page is charset = UTF-8 "pageencoding =" UTF-8 "%>

Add page

Charset = UTF-8 "pageencoding =" ISO-8859-1 "%> can write Chinese, display page normal

Charset = ISO-8859-1 "pageencoding =" UTF-8 "%> database display garbled, but data, display page normal

Charset = ISO-8859-1 "pageencoding =" ISO-8859-1 "%> write exception

Charset = UTF-8 "pageencoding =" UTF-8 "%> normal

2. When the display page is charset = ISO-8859-1 "pageencoding =" UTF-8 "%>

Add page

Charset = UTF-8 "pageencoding =" ISO-8859-1 "%> database display garbled, but data display normal, display page garbled

Charset = ISO-8859-1 "pageencoding =" ISO-8859-1 "%> database display garbled, but data display normal, display page garbled

Charset = ISO-8859-1 "pageencoding =" UTF-8 "%> database display garbled, but data display normal, display page garbled

Charset = UTF-8 "pageencoding =" UTF-8 "%> database display garbled, but data display normal, display page garbled

3. Conclusion

The principle obtained from the above data experiment is unknown.

Suggestion: Set all pages to charset = UTF-8 "pageencoding =" UTF-8 "%> Gold partner,

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: 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.