Modify the default encoding of eclipse in Windows

Source: Internet
Author: User

Generally, the system code in Windows is gb2312 (the Chinese version of Windows). Because I prefer UTF-8 encoding, I will share with you the modification method.

If you want to make the new build project, java files directly make the UTF-8, you need to do the following:
1. Windows-> preferences... open the "Preferences" dialog box, navigation tree on the left, navigation to general-> workspace, and right
Text file encoding, select other, change to UTF-8, and then the text file in the Properties dialog box of the new project
Encoding is the UTF-8.

2. Windows> preferences... open the "Preferences" dialog box, navigate to General> content in the navigation tree on the left.
Types, right-side context types tree, Open Text, select Java source file, in the following default
Enter the UTF-8 In the encoding input box, and click Update to set the Java file encoding to UTF-8. Other Java application development-related files
Properties, XML, and so on have been specified by the eclipse default, respectively for the ISO8859-1, UTF-8, such as development does 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 compilation, running, debugging is no problem, but when the RCP application product output, or
When the plug-in outputs, errors always occur, either the compilation fails (compile must be re-compiled during output), or the Chinese characters are garbled during the runtime of the output plug-in. In this case, you need to re-use the RCP application or plug-in
Add a line in build. Properties of the plugin project, javacdefaultencoding... =
UTF-8. Let the output compile know the UTF-8 encoding for the Java source file. This setting needs to ensure that all Java source files are UTF-8 encoding format, if not all, you can refer
Eclipse Help Guide> reference>
Feature and plug-in build configuration), we recommend that all Java source files be UTF-8-encoded.

If the plug-in development, RCP application development based on other encoding, such as gb18030, want to convert to UTF-8, first, do the above work; then through the search encoding conversion tool, such as based on
Iconv bulk Conversion Tool, convert the original encoding to UTF-8 encoding, note that only the conversion of Java source files, other types of files may already be more suitable for encoding; will be in the original engineering properties
Text file encoding, from the original encoding to the UTF-8.

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.