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,