MyEclipse Chinese garbled, coded format set, file encoding format __ Code

Source: Internet
Author: User
Tags save file
Set the default encoding format for the new common file, which is the file save format.
When you do not set the MyEclipse, the default save file encoding, generally with the Simplified Chinese operating system (such as WINDOWS2000,WINDOWSXP) of the code, that is, GBK.
Under the Simplified Chinese system, ANSI encoding represents GBK encoding, and ANSI encoding represents JIS encoding under Japanese operating systems.
Window-->preferences-->general-->content Types
In the right window, expand each subkey, and then enter the encoding format, such as "UTF-8" click "Update" is set.
For example: In the above settings, set the JSP default encoding format "UTF-8", then the new JSP file, are in the "UTF-8" format saved.
Also set the Java default encoding format to "UTF-8", then the new Java file will be saved in the format "UTF-8".
Set the HTML default encoding format to "UTF-8", then the new HTML file is saved in the format "UTF-8".
The above set the file save encoding format, the default mode of opening (decoding) will be the same as the Save encoding format.

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

The format is saved, and the encoding format is saved with the default file GBK. This default save encoding format can be modified as follows:
Window-->preferences-->general-->workspace on the right Text file encoding->other Select UTF-8

Third, a single file 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 MyEclipse what encoding format to use for decoding.
On the file you want to view, such as the right key on the file Test.java-->properties-->resource on the right text file encoding->other, you can modify it.
For example, if you set the encoding format for the *.java file to "UTF-8" in "One", you open the file with the suffix named Java, which is decoded by default in "UTF-8" format. If someone gives you a

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

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

Iv. Specify the page content data encoding format when writing documents, such as HTML, or before submitting the form in the JSP Web page, the user input information encoding format, the parameter encoding format in the configuration file XML, etc. myeclipse.
The main is to inform the browser or server, the transmitted data encoding format.
Window-->preferences-->myeclipse-->files and editors--> Select subkeys-->encoding
For example: Select UTF-8,
When creating a new JSP file, contenttype= "text/html;" Charset=utf-8 "pageencoding=" UTF-8 will be automatically generated, do not have to manually change each time.
When creating a new HTML file, http-equiv= "Content-type" content= "text/html;" Charset=utf-8 "
When you create a new XML file, <?xml version= "1.0" encoding= "UTF-8"?>


The above is summarized by yourself, if wrong, please point out. The problem is as follows
1, if someone else gave a project, encoding format for GBK, I use the encoding format for UTF-8, import this project, display garbled, need to make what changes.
I want to know the most useful and necessary modification methods. If I change the top points in turn, they will be displayed correctly. But after the change, the view of their own code will appear in Chinese garbled.
In fact, the problem is, how to get two project to use different encodings (such as UTF-8 and GBK), and can be viewed normally without garbled characters.

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.