Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse encoding conversion

Tags:

eclipse

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 :)

like image 259
Prody Avatar asked Dec 10 '08 20:12

Prody


People also ask

How do I change the encoding of a properties file in Eclipse?

properties files are Latin1 (ISO-8859-1) encoded by definition. ISO-8859-1 as its default encoding. You can change this under: Preferences > General > Content Types.

How to check encoding of file in Eclipse?

Use the ICU component to detect the possible encodings of the current editing text file, and alert you to change encoding if the encoding may not be set correctly. Allow you to change encoding through the popup menu.


3 Answers

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!

like image 118
Smair Avatar answered Oct 05 '22 05:10

Smair


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.

like image 44
BASTA_exclamation_mark Avatar answered Oct 05 '22 03:10

BASTA_exclamation_mark


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.

like image 21
James Van Huis Avatar answered Oct 05 '22 05:10

James Van Huis