When someone else's project or Java file is imported into their own eclipse, the Chinese comments of the Java file are often garbled, the main reason is that others' ide encoding formats are different from their own eclipse encoding formats (the default eclipse encoding method is GBK.
To sum up the suggestions and experiences on the Internet, you can refer to the following solutions:
1. Change the encoding format of the entire file type
1) eclipse-> window-> preferences-> General-> content types
2) Find the type of the file to be modified (Java, JSP, etc.), there is a default encoding below, enter GBK in the input box
3) Click Update.
4) Click OK.
5) Restart eclipse
2. Change the encoding format of the entire eclipse workspace.
1)Eclipse-> window-> preferences-> General-> Workspace-> text file encoding
2)Change the encoding format of text files
3. Change the coding format of a single project (common include GBK and UTF-8)
Right-click Project in package Explorer-> Attribute, change the encoding format of text files (commonly known as GBK and UTF-8)
4. If the above methods still cannot be solved, you can do the following:
Use editplus to open the file to be transcoded. If there is no garbled code in editplus, you can directly copy the file content to eclipse. If editplus is garbled, You can first transcode the file in editplus, editplus-> Document-> File encoding-> Change the file encoding method.-> GBK, and then use eclipse to open it.
Attachment: In my practical experience, changing the encoding method of a single project may not solve the garbled problem, but using method 2, that is, changing the encoding method of the entire workspace can solve the garbled problem. But remember to switch back to the original encoding method, otherwise it will affect other projects in the workspace.
From: http://zhuixue.iteye.com/blog/384340