Question about Chinese garbled characters in servlet of J2EE program, selection of JSP page encoding format

Source: Internet
Author: User

When encoding in JSP is GBK, the encoding conversion process is as follows: Assume: GBK code ("you")-> urlencode is changed to-> (% 3f % 2f) -> Tomcat automatically redirects you one ISO-8859-1-> get (23 43 68 23 42 68 each symbol is represented as an encoding in the ISO-8859-1) -> receive page ---> convert to byte array of ISO-8859-1 again,] ---> convert to readable text with GBK ---> (% 3f % 2f "----> to (" you "). However, when the page encoding is utf8, you do not need to transcode the page in the servlet, because the utf8 encoding will not be garbled.
Therefore, we recommend that you directly select utf8 for page encoding during development, so there is no transcoding trouble.

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.