Accepted answer

as mentioned here and here:

set file encoding to utf-8 and line-endings for new files to unix, so that text files are saved in a format that is not specific to the windows os and most easily shared across heterogeneous developer desktops:

  • navigate to the workspace preferences (general:workspace)
  • change the text file encoding to utf-8
  • change the new text file line delimiter to other and choose unix from the pick-list

alt text

  • note: to convert the line endings of an existing file, open the file in eclipse and choose file : convert line delimiters to : unix

tip: you can easily convert existing file by selecting then in the package explorer, and then going to the menu entry file : convert line delimiters to : unix


you could give it a try. the problem is that windows inserts a carriage return as well as a line feed when given a new line. unix-systems just insert a line feed. so the extra carriage return character could be the reason why your eclipse messes up with the newlines.

grab one or two files from your project and convert them. you could use notepad++ to do so. just open the file, go to format->convert to unix (when you are using windows).

in linux just try this on a command line:

sed 's/$'"/`echo \\\r`/" >


to recursively remove the carriage returns (\r) from the cvs/* files in all child directories, run the following in a unix shell:

find ./ -wholename "\*cvs/[re]\*" -exec dos2unix -q -o {} \;


in addition to the eclipse solutions and the tool mentioned in another answer, consider flip. it can 'flip' either way between normal and windows linebreaks, and does nice things like preserve the file's timestamp and other stats.

you can use it like this to solve your problem:

find . -type f -not -path './.git/*' -exec flip -u {} \;

(i put in a clause to ignore your .git directory, in case you use git, but since flip ignores binary files by default, you mightn't need this.)


there is a handy bash utility - dos2unix - which is a dos/mac to unix text file format converter, that if not already installed on your distro, should be able to be easily installed via a package manager. dos2unix man page


i had the same, eclipse polluted files even with one line change. solution: eclipse git settings -> add entry: key: core.autocrlf values: true

enter image description here

enter image description here

Related Query

More Query from same tag