To have a Java source file open with the encoded format UTF-8, there are 2 things to do:
1) Set the default encoding format for Java source files to UTF-8;
2) Set the workspace encoding format to UTF-8.
The corresponding settings are as follows:
set the default encoding format for Java source files to UTF-8
On the Windows->preference page, select General->content Types
In the box on the right, select Text->java Source File and change the following Default Encoding to UTF-8
set the encoding format for workspace to UTF-8
On the Windows->preference page, select General->workspace
Select the Text File encoding in the right-hand box and change to UTF-8
After setting these 2 places, the default open Java source file is UTF-8 encoded.
Ext.: http://blog.csdn.net/wwang196988/article/details/6775270
How to set the Java source file in Eclipse to UTF-8 default encoding (GO)