14 ways to solve Web character encoding problems

Source: Internet
Author: User

The problem of solving Chinese characters garbled is broadly divided into the following types:

1.jsp header set Pageencoding to "Utf-8"

2..jsp header Settings contenttype= "Text/html;charset=utf-8"

3.Window >>> Preferences >>> Workspace Workspace Setup encoding format: UTF-8

4.Window >>> Preferences >>> General >>> Content Types >>> Text setting encoding formats for various types of files

5. Right-click Resource Project Properties >>> Resource resource File Settings UTF-8

6.Tomcat conf files in the Server.xml file, in the <Connector> node, you can modify the encoded character format uriencoding= "UTF-8"

7. Set the character encoding in the Web. xml file in the project file web-inf directory file

<jsp-config>

<jsp-property-group>

<url-pattern>*.html</url-pattern>

<page-encoding>UTF-8</page-encoding>

</jsp-property-group>

</jsp-config>

8.

9. Declarations in HTML are written to <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>

10. By request.setcharacterencoding ("UTF-8"); Sets the encoding format for the character stream of the requested output

11. Use of Response.setcontenttype ("Text/html;charset=utf-8"); Sets the character encoding format of the response, which controls the browser decoding with UTF-8

12. Use Response.setheader ("Content-type", "text/html;charset=utf-8"); Tell the browser to parse with Utf-8

13. Get string strings, via new string (variable name. GetBytes ("Iso-8859-1"), "UTF-8"); Converts a character to a binary array constructs a new string using the specified character encoding

14. Write the DAO configuration file. What database name does the properties need to access in the URL? Characterencoding=utf-8 setting the specified character encoding

14 ways to solve Web character encoding problems

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.