notepad++ adding extra lines to a file
I've been bugged with this problem for ages and I just tried to ignore it, but when I open files for the first time that was saved from a mac/unix box, I get to see an extra line break after each line:
something like
this
which is pretty
annoying
What I usually do is just do one of the many fixes for this behavior in google, like the TextFX solution to delete all blank lines.
But I am just curious as to why this happens. Why? Why does it not happen again even if I save the file, push it to the git repo(and when it gets edited by another user in a mac/unix) I don't get this problem anymore?
EDIT
the git problem was a problem I had before but our current problem right now is that we are uploading files using rail's paperclip, which saves it to the file system(we are using a windows machine). when we open the files, we see it as "macintosh" "ansi" even if the server is running on windows. is there a way to make it open it with the proper encoding by default?
Solution 1:
I've been struggling with the same issue for several years, but after reading this post and trying some settings in Notepad++ it didn't appear to be Notepad++ that's changing the LF or CR settings.
My 'problem' was caused by a Filezilla setting, with which I download the files from my website to edit them in Notepad++.
In Filezilla I had a lot of extensions in the setting 'Automatic file type classification' (go to Edit > Settings > Transfers > File types). After I cleared them all and re-downloaded my file it opened just fine in Notepad++, no more extra line breaks. Also tested to edit the file, upload it, download and edit it again.
So, in Notepad++ my default setting for new files is:
- Encoding: ANSI
- Format: Windows
And in Filezilla the settings are:
- Transfer type: Auto
- Automatic file type classifications: extensions list is empty
This solved my problem.
Hope it helps.
Solution 2:
I tried the above solutions and none were working for me, but it did turn out that it was FileZilla though.
I found a recommendation in one of their forums to transfer using binary mode instead of auto. Once I changed this, my problem was solved. :)
Exerpt:
Set Transfer type (menu Transfer) from Auto to Binary and upload your script.