How to resolve Eclipse's Chinese garbled problem

Source: Internet
Author: User
Tags resource

Using the Eclipse edit file often appears in Chinese garbled or the file has a problem with the Chinese can not be saved, Eclipse provides the flexibility to set the file encoding format options, we can set the encoding format to solve the garbled problem. In Eclipse, you can set the encoding format from several levels: Workspace, Project, Content Type, File

This article takes Eclipse 3.3 (English) as an example to illustrate:

1. Set the workspace encoding format:

Windows->preferences ... Open the Preferences window, click the left navigation tree to General->workspace, find the "Text file encoding" option setting in the right view, either by default, or by selecting from the Drop-down list (other). The default encoding for Eclipse workspace is the operating system encoding format, which is related to the setup of the operating system; Alternatively, we can select the other radio button and select the desired encoding format from the Drop-down list on the right side of the button (GBK, iso-8859-1, UTF-16, UFT-16 etc.).

2. Set the encoding format for project:

The new project in workspace Inherits workspace encoding settings by default, and we can change the encoding format of an item individually. Right click on the project, select Properties, open the Project Properties Settings window, the left navigation tree Select Resource, in the right view to find "Text file Encoding", two settings for the encoding of the project, the default selected is "inherited from Container (XXX) "(Note: XXX for workspace set the encoding), we can also choose other encoding format, set the way with workspace.

3. Set the encoding format for the content type:

Sometimes we want to keep the entire workspace a certain type of file in the same encoding format, which requires the content type settings to achieve the purpose, as follows: Windows->preferences ... Open the Preferences window, the left navigation tree selects General->content Types, selects Text->java Source File in the right view, the default encoding input box at the bottom, and manually enters the encoding format, Click the Update button to make the settings effective (remember!) )。 There are two points to note:

A. This setting makes the same type of files under all items of workspace the same encoding format, and changing the encoding settings of the project does not affect the encoding settings of the file types in the project;

B. Default Encoding is entered manually and the encoded name you enter is accurate, otherwise the unsupported Character Encoding is displayed when you open this type of file.

4. Set the encoding format for file:

We can also set the encoding format for a single file, either by setting the encoding grid (such as ' charset=utf-8 ') in the file, or by setting the file property. Right-click on a file, select Properties, open the File Properties dialog box, the right navigation tree Select Resource, in the right view through the "Text file Encoding" Select the encoding format of the settings file.

Author: csdn Blog tfy1332

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/

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.