https://jingyan.baidu.com/article/2009576193ee38cb0721b416.html
Modify workspace default encoding
-
Enter Eclipse, import a project project, if the encoding of the project file is inconsistent with your tool encoding, it will cause garbled characters. Such as:
-
If you want to enable the plug-in development application to have better internationalization support and to support Chinese output to the greatest extent, it is best to use UTF-8 encoding for Java files.
Modify the default encoding
On the menu navigation bar Window-->Preferences to open the "Preferences" dialog, the left navigation tree, navigate to General-->Workspace
-
Windows 7 platform defaults to GBK, Simplified Chinese operating system Windows XP, Windows 2000 Simplified Chinese default encoding is GB18030, Linux platform defaults to UTF-8
Then the project code created in this workspace is GBK, and the java file created in the project is also GBK.
You can see that the default is GBK encoding format, we modify it to UTF-8 encoding format or the encoding format you need
Click Apply and click OK.
END
Modify the encoding of the file
-
Sometimes we import the project file, but it is not imported into our workspace, it is just a reference. If there is a coding problem at this time, we can modify the coding of the file to view it.
Right-click on the Eclipse project file, select Properties, and select Modify the encoding format in Resource
END
Modify the encoding of a file type
-
Sometimes we need certain types of files, such as: *.jsp, *.java, etc.
Navigation bar window-->preferences
Open the "Preferences" dialog, navigate the tree on the left, navigate to Genera-->Content Types
-
Find the type of file to be modified on the right, I take *.java as an example
In the Default encoding below, enter UTF-8->Update->OK in the input box
END