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.
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-> workspacetypes
2) Change the encoding format of text files to GBK.
3. Change the encoding format of a single file
In package explorer, right-click File> properties to change the text file encoding format to GBK.
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 method-> change the file encoding method-> GBK, and then use eclipse to open it.
PS: The first two methods may be effective only when a new file is created. If you only want to transcode a file, we recommend that you use the last two methods.