Eclipse annotation garbled Solution

Source: Internet
Author: User

When someone else's projects and java files are imported into their own eclipse, the Chinese comments of the java files are often garbled, the main reason is that other people's development environment editor encoding format and their own eclipse encoding format is different, such as others with the UTF-8, their own is GBK, in this way, Chinese characters may be garbled after being imported.
The default character encoding of the eclipse workspace is the default encoding of the operating system, and the default encoding of the simplified Chinese operating system (Windows XP, Windows 2000 Simplified Chinese) is gb18030, the project code created in this workspace is gb18030, And the Java file created in the project is also gb18030. We can change the default encoding format of eclipse, and set the encoding format for the entire workspace, the entire project, the entire file type, and a single file. The general Java file encoding format is UTF-8. The following uses changing the default GBK to UTF-8 as an example.
1. Change the encoding format of the entire workspace. In this way, the newly created file will also be in the new encoding format.
Eclipse-> window-> preferences-> General-> workspacetypes-> Other-> UTF-8-> OK
Finished: eclipse-> window-> preferences-> General-> Workspace-> Other-> UTF-8-> OK

2. Set the encoding format for the project scope
Project-> properties-> General-> resource-> Other-> UTF-8-> OK

3. encoding format of a certain type of file
Eclipse-> window-> preferences-> General-> content types-> Find the type of the file to be modified on the right (Java, JSP, etc.)-> In the following default encoding, enter UTF-8 in the input box-> Update-> OK
Chinese version: eclipse-> window-> preferences-> General-> content type-> select the type of the file to be modified on the right-> enter the default encoding below-> Update

4. Set the encoding format for a single file
In package explorer right-click File-> Properties and change the text file encoding format to UTF-8

Note: Back up data before changing the encoding format. In addition, you can use a batch conversion tool to search for many such gadgets on the Internet.

From: http://www.freezq.cn/list/..%5Carticle%5C418.htm

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.