views:

909

answers:

3

When I open a file in eclipse it shows with the improper line spacing showing an extra line break between every line. When I open the file with notepad or wordpad it doesn't show these extra line breaks that only eclipse shows. How do I get eclipse to read these files like notepad and wordpad without those line breaks?

-edit: I don't have this problem with all files but only a select few where I have made local changes > uploaded them to our sun station > then pulled those files back to my local workstation for future modifications.

+2  A: 

Eclipse should have a File -> Convert Line Delimiters To... option that may correct this for you. (If it doesn't work on your file, this article may help.)

Really, though, you should have your file transfer program treat your source files as ascii instead of binary. Then your line ending problem should be moot.

Nate
Text instead of binary. Good point.
Raithlin
A: 

It's possible that the server (or something in-between) is replacing all your CR+LF with CR LF (separate)?

Try specifically setting the Text File Encoding (Window->Preferences->General->Workspace), or alternatively use File->Convert Line Delimiters To->Windows every time you get the latest version (I know, not ideal).

Raithlin
What is the difference between CRLF, CR LF, and CR+LF? As far as I know, there is none, they all refer to a linefeed character immediately following a carriage return (\r\n).
Daniel Papasian
Correct. I don't know what I was thinking. :) The point I was trying to get across was that what Windows had added (CRLF) had been separated into what Windows then saw as two commands instead of one.
Raithlin
A: 

It turns out that the problem was solved by doing my ftp in binary only, and setting the Eclipse encoding to US-ASCII. I don't fully understand why this fixed the problem but it worked. Thanks for the 2 answers they both lead me to my solution.

Andrew Jahn