Meaning of encoding settings in JSP

Source: Internet
Author: User
<% @ Page Language = "Java" pageencoding = "UTF-8" %>
<% @ Page contenttype = "text/html; charset = iso8859-1" %>
<HTML>
<Head>
<Title> Chinese </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
</Head>
</Head>
<Body>
Encoding in JSP
</Body>
</Html>
========================================================== ========================================================== ===
1. The encoding format of <% @ page Language = "Java" pageencoding = "UTF-8" %> is the storage format of JSP files. Eclipse saves the file according to the encoding format. Compile the JSP file, including Chinese characters.
2. <% @ page contenttype = "text/html; charset = iso8859-1" %> encoding is in decoding format. Because the file stored as a UTF-8 is decoded as a iso8859-1, such as a Chinese certainly garbled. That is, it must be consistent. The row in the second part does not exist. By default, it is also the encoding format that uses the iso8859-1. If this line does not exist, "I am a good person" will also be garbled. Must be consistent.
3. <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"> encoding is used to control the browser's decoding method. If all the preceding decoding operations are consistent and correct, the encoding format does not matter. Some web pages are garbled because the browser cannot determine which encoding format to use. Because the page is sometimes embedded into the page, the browser obfuscated the encoding format. Garbled characters appear.
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.