MyEclipse JSP Chinese garbled

Source: Internet
Author: User

At the very beginning, add

<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%> this must be UTF-8
<%@ page contenttype= "Text/html;charset=utf-8"%> this does not work!!!!

In the

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>//here must be UTF-8

You can do it.

Save could not being completed

http://red-apple.blog.163.com/blog/static/201165061201201144012489/

Http://img0.ph.126.net/9y4I3oOvnsvg1UMlYeCOfw==/1110137308164020410.jpg

Http://img9.ph.126.net/nFLOaXtgPDXEq0W84nHb9A==/2651494280631572329.jpg

Very useful, the following transfer from http://www.cnblogs.com/niuniutry/p/3367575.html

First, set the default encoding format for new common files, that is, the format of file saving.
When the MyEclipse is not set, the default encoding of the saved file, generally with the Simplified Chinese operating system (such as windows2000,windowsxp) encoding consistent, that is, GBK.
In the Simplified Chinese system, the ANSI code represents the GBK encoding; in the Japanese operating system, the ANSI encoding represents the JIS code.
Window-->preferences-->general-->content Types
Expand each subkey in the right window and enter the encoding format, such as "UTF-8" and click "Update" to set it up.
For example: In the above settings, set the JSP default encoding format is "UTF-8", then the new JSP files are in "UTF-8" format saved.
Similarly, the Java default encoding format is "UTF-8", then the new Java files are saved in "UTF-8" format.
Set the HTML default encoding format to "UTF-8", then the newly created HTML file is saved in "UTF-8" format.
The above set the file save encoding format, the default mode of opening (decoding) will be the same as saving the encoding format.

Second, set the default encoding format for new files, that is, file save format.
In the first setting, only the encoding format of the common file type is set. If you create a new file without a suffix name, that is, the file type is not named, then MyEclipse cannot determine which encoding to use

Format, save the encoding format GBK with the default file. This default save encoding format, can be modified as follows:
Window-->preferences-->general-->workspace on the right Text file encoding->otherSelect UTF-8

Third, individual files view the encoding format (that is, the encoding format used to open the file) changes. This method does not change the encoding format of the file, just tells the MyEclipse what encoding format to decode.
On the file to be viewed, such as file Test.java right-click-->properties-->resource on the right side of the text file encoding->other, you can modify it.
For example, you set the *.java file in the "one" in the encoded format "UTF-8", then you open the suffix named Java file, the default will be "UTF-8" format to decode. If someone gives you a

Write good Java file, but he is saved with GBK code, then you open now, will show garbled. Right--->properties-->resource on this file on the right side of the text file

Encoding->other->GBK, you can normally display the contents of the inside.

Iv. specify the format of the page content data encoding when writing the myeclipse, such as HTML, or the JSP Web page before submitting the form, the user input information encoding format, configuration file XML parameter encoding format.
The main is to notify the browser or server, the transmission of data encoded format.
Window-->preferences-->myeclipse-->files and editors--> Select the subkey-->encoding
For example: Select UTF-8,
When creating a new JSP file, contenttype= "text/html; Charset=utf-8 "pageencoding=" UTF-8 "will be generated automatically, without having to manually change it every time."
When creating a new HTML file, http-equiv= "Content-type" content= "text/html; Charset=utf-8 "
When creating a new XML file, <?xml version= "1.0" encoding= "UTF-8"?>

MyEclipse JSP Chinese garbled

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.