bukka.wh
bukka.wh

Reputation: 913

Change encoding in Eclipse

I was working on my project in Windows using Eclipse (and I didn't check that my encoding was CP-1251). Now am going to work with my project in Linux with Eclipse too, but with UTF8 encoding, so all my comments are now non readable.

Can I just reconvert them into UTF using Eclipse?

Upvotes: 10

Views: 28926

Answers (3)

George Z.
George Z.

Reputation: 6818

In my case, I wanted to change the encoding for some .properties files.

I guess it works for other file types as well.

What I did and worked perfectly is:

Go to Window --> Preferenes --> General --> Content Types --> (Expand) Text--> Find Java Properties File --> Changed Default Encoding to UTF-8 --> Clicked Update

Here is a picture:

preview

I do not know if this option exists in previous versions, but my version is 2020 - 06.

Upvotes: 0

Bartek B.
Bartek B.

Reputation: 149

There is a plugin for Eclipse "Autodetect Encoding" - you can detect/convert the encoding in files. It can be found in the Help->Marketplace...

I just started testing, but it works so far.

Hint: sometimes you need to change the detector to ICU4j

And even if the convert does not work in a current document (because of detection) you can do this: CTRL+C on one enconding switch to another and CTRL+V it will paste correct then save.

Upvotes: 1

Arnaud Potier
Arnaud Potier

Reputation: 1780

You can set up the encoding used by eclipse in the Preferences section

Window -> Preferences -> General -> Workspace -> Text file encoding

You can also override it for a single project only if that is the only project you are having trouble with.

Upvotes: 15

Related Questions