How to set the encoding format in Eclipse to avoid garbled characters?

Setting the encoding format in Eclipse can help avoid garbled characters. You can follow these steps to set it up.

  1. Open the Eclipse IDE.
  2. Select “Window” from the menu bar and then select “Preferences”.
  3. In the pop-up dialog box, expand “General” and select “Workspace”.
  4. Choose the encoding format you want to use, such as UTF-8, from the dropdown menu under “Text file encoding” on the right side.
  5. Select “Other” under “New text file line delimiter” and choose the line delimiter that is suitable for your operating system, such as “Windows” for Windows operating systems.
  6. Click on the “Apply and Close” button to save and close the settings.

After setting up the above steps, newly created files will use the selected encoding format by default, which can help avoid garbled text issues. If existing files are showing garbled text, you can try resaving them in the selected encoding format, or manually specify the correct encoding format when opening the file.

广告
Closing in 10 seconds
bannerAds