notepad++ adding extra lines to a file

7,661

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.

Share:
7,661

Related videos on Youtube

corroded
Author by

corroded

Updated on September 18, 2022

Comments

  • corroded
    corroded almost 2 years

    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?

    • Admin
      Admin about 13 years
      What version are you using? I never had this problem here. Also, what characters show up when "Show All Characters" is enabled?
    • Admin
      Admin about 13 years
      do you have an example file?
    • Admin
      Admin about 13 years
      we are using the latest version of notepad++, we just downloaded it and all the files we load are in "macintosh" "ansi" at the lower right corner. We tried the conversion thing to no avail though. the best we could do was to replace all "\r" with a blank space and it worked. we would like to open files like those by default as "windows" "utf8" to avoid the double line breaks...is this possible?
    • Admin
      Admin about 12 years
      My guess is that you're getting bit by some file transfer quirk, such as the one described below by Dick.
  • corroded
    corroded about 13 years
    thanks for the informative response! we tried it in a new installation of notepad++ and like i said in the comments above, we fixed it by replacing "\r" with a blank space. we would like to skip this step though as it is tedious. is this possible? i also added some additional info in the question
  • Paxxi
    Paxxi about 13 years
    I don't know of a way to force Notepad++ to treat it as a specific format so no help there. I think you're problem lies elsewhere though. My guess would be that the file is damaged/malformed causing notepads format detection to fail. Possibly that the file contains "\r \n"(notice the space) instead of "\r\n" or any number of nonstandard combinations.
  • rybo111
    rybo111 about 9 years
    +1 but for me, I just changed the 'Default transfer type' to Binary.