Eclipse Modify Encoding

Source: Internet
Author: User

In the development and use of eclipse, we often use UTF-8, but just installed or imported project is the default of the other encoding is GBK, which causes our project garbled, some Chinese parsing can not be viewed, the development caused inconvenience.

Tools/Materials
    • Eclipse
Modify Workspace default encoding
    1. 1

      Enter Eclipse, import a project engineering, if the project file encoding inconsistent with your tool code will cause garbled. Such as:

    2. 2

      If you want to enable plug-in development applications to have better internationalization support, to maximize the support of Chinese output, it is best to make Java files using UTF-8 encoding.

      Modifying the default encoding

      On the menu navigation bar window-->preferences Open the Preferences dialog box, left navigation tree, navigate to General-->workspace

    3. 3

      Windows 7 platform defaults to GBK, Simplified Chinese operating system Windows XP, Windows 2000 Simplified Chinese default encoding is Gb18030,linux platform default is UTF-8

      Then the engineering code established in this workspace is GBK, and the Java file created in the project is also GBK.

      Can see the default is the GBK encoding format, we modify to UTF-8 encoding format or you need the encoding format

      Click Apply and click OK.

      END
Modifying the encoding of a file
    1. 1

      Sometimes we import project files, and do not import into our workspace, just a reference, this time if there is coding problem, we can modify the file encoding view.

      Right-click on the Eclipse project file, select Properties, and in resource Select Modify encoding format

      END
Modify the encoding of a file type
    1. 1

      Sometimes we need some kind of file, such as: *.jsp, *.java, etc.

      Navigation bar Window-->preferences

      Open the Preferences dialog box, left navigation tree, navigate to Genera-->content Types

    2. 2

      On the right, find the type of file you want to modify, and I'll take *.java for example.

      In the default encoding below, enter Utf-8->update->ok in the input box

      END
To modify the encoding of a single file
    1. In Package Explorer, right-click File--Properties, change the text file encoding format to UTF-8

    2. After the above steps, the new Java file is UTF-8 encoded, the new project is also UTF-8 encoded,

      Eclipse compiles, runs, and debugs all without problems.

      END
Precautions
    • Please keep the code consistent, otherwise it will cause garbled, in Java development generally to UTF-8 mainly
    • You can back up the code before you convert it

Eclipse Modify Encoding

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.