Sheri
Sheri

Reputation: 75

Special characters after converting from CP1252 to UTF-8 encoding

I have a bulk of Java-files in Eclipse that was written when my Eclipse had CP1252 as encoding. I am in Sweden and we have special character (Å å Ä ä Ö ö). Now we have changed the encoding to UT-8. All special characters is ruined now to strange characters instead!! Is there any other solution instead of open each file and rewrite all the special characters again?

Upvotes: 4

Views: 2565

Answers (1)

Shubham Kishore
Shubham Kishore

Reputation: 21

I was facing the same issue in my project. Here are the steps that I followed:

  1. I first copied the contents of the file to notepad++(copy to any editor which supports utf-8).
  2. Eclipse uses the cp1252 encoding for files by default on Windows. After copying file contents, you need to change the encoding to utf-8. You can do this by going to Window->Preferences->Workspace. There you will find text file encoding, change it to utf-8 and apply and close. You will notice that characters like (Å å Ä ä Ö ö) have changed to some strange characters.
  3. Copy the contents that you had saved in the notepad++(or your editor) to the file in eclipse and save the file. That's it!

Run your project, it should not give any warnings or errors for those characters now.

Upvotes: 2

Related Questions