Issues with Eclipse file encoding settings

Source: Internet
Author: User

How encoding is set in eclipse

If you want to enable plug-in development application to have better internationalization support, can support the Chinese output to the maximum extent,

It is best to make the Java file Use UTF-8 encoding. However, the Eclipse workspace (workspace) lacks

Save character encoding is the default encoding of the operating system, Simplified Chinese operating system

(Windows XP, Windows 2000 Simplified Chinese) The default encoding is GB18030, in this workspace

The established engineering code is GB18030, and the Java file created in the project is also GB18030. If you want to make the new project, Java files directly to UTF-8, you need to do the following:

1. Windows->preferences ... Opens the Preferences dialog box, the left navigation tree,

Navigate to General->workspace, right text file encoding, select Other,

Change to UTF-8, and the text file encoding in the Properties dialog box for the new project later is UTF-8.

2. Windows->preferences ... Opens the Preferences dialog box, the left navigation tree,

Navigate to General->content Types, right context Types tree, tap text,

Select Java Source file, enter UTF-8 in the default encoding input box below, and click Update to set the Java files encoding to UTF-8. Other Java application development related files such as: properties, XML, etc. have been specified by the Eclipse default, respectively, Iso8859-1,utf-8, such as the development of the need to change the encoding format can be specified here.

3, after the above two steps, the new Java file is UTF-8 encoding, Eclipse compile, run, debug all no problem, but do rcp application product output, or plug-in output, always error, or can not compile through (the output to re-compile), Or the output of the plug-in runtime Chinese display garbled. At this time need to re-rcp application, or plug-in plugin project Build.properties add a line, javacdefaultencoding. = UTF-8.

Let the output compile when you know the Java source file UTF-8 encoded. This setting is required to ensure that all Java source files are UTF-8 encoded in the format

, if not all, refer to the Eclipse Help

(Plug-in development Environment Guide > Reference > Feature and Plug-in Build configuration),

It is recommended that all Java source files are UTF-8 encoded.

If plug-in development, RCP application development originally based on other coding, such as GB18030, want to convert to UTF-8, then first, do the above work

And then convert the original encoding to UTF-8 encoding by looking for the encoding conversion tool, such as the Iconv-based bulk conversion tool,

Note that only the Java source file is converted, other types of files may already be more appropriate encoding, the original project properties of the Text file encoding, from the original code to UTF-8.

Issues with Eclipse file encoding settings

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.