Http://kodak-zhou.iteye.com/blog/1004722
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