Prody
Prody

Reputation: 5298

Eclipse encoding conversion

Does anyone know of any eclipe plugin that lets you easily change and use file encodings? I sometimes need to edit template files to do small tweaks, but the files are sometimes ISO, sometimes UTF8, sometimes others, so using eclipse for this leads to disaster :)

Upvotes: 7

Views: 8285

Answers (4)

Bartek B.
Bartek B.

Reputation: 149

I just found 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

Smair
Smair

Reputation: 353

Try this for converting one file:

  1. Copy the whole Content of your file to the clipboard (by pressing ctrl+c or cmd+c on Mac)
  2. Right-Click on the file, then open "Properties" and change the text file encoding to the preferred one
  3. Press ctrl-a (or cmd-a on Mac) to select the whole text and replace it with the content of your clipboard (ctrl-v or cmd-v)

Source: http://artur.ejsmont.org/blog/Convertig-file-encoding-to-UTF-8-from-other-Unicode-and-removing-Byte-Order-Marks

Worked on my Mac!

Upvotes: 16

Changing the encoding in the Properties does the exact opposite of transcoding the file: it reinterprets the file's contents as if it were encoded in the specified encoding. This is useful too, but is not the functionality Prody wants.

There is apparently no way to actually transcode a file within Eclipse.

Upvotes: 7

James Van Huis
James Van Huis

Reputation: 5571

This should be in the Properties of each file.

Under the "Info" header, there is a "Text File encoding" group. You can change the selection to "Other", and choose the desired encoding from there.

Upvotes: 5

Related Questions