PDA

View Full Version : Using FireFTP to download text file adds line breaks


WA
01-12-2010, 08:50 AM
Does anyone know why this is so- when I download text files from my server back to my PC using FireFTP, there's an extra line break inserted after every line, whether it's a .js file, .html etc. Uploading doesn't do this, and preserves the original format of the file contents. I thought it might have something to do with encoding, but why would it only affect downloads and not uploads? Also, playing around with some of the encoding settings in FireFTP didn't solve the problem.

_Aerospace_Eng_
01-12-2010, 09:05 AM
I think this might be an issue with your server. I just created an html file with no new lines at the end, uploaded with fireftp, downloaded with fireftp and the file is the same (no new lines). The md5 hashes are the same too.

WA
01-12-2010, 09:14 AM
Hmm I don't believe it's the server actually, since this happens on two different servers (from two different hosts). My desktop PC is running Windows 7 btw. I don't recall this problem on my older Win XP PC.

Spookster
01-12-2010, 10:18 AM
Sounds like either your FTP client or server may be handling the conversion of the files incorrectly. When you FTP a text file from one platform say Windows to another Unix the file must be converted to account for the differences in how each platform handles carriage returns and line feeds. FTP clients/servers do this for you automatically depending on which mode you transfer in. What mode are you transferring the files? Auto/Ascii/Binary? Text files you generally want to transfer them in Ascii mode which would allow the FTP server to convert the file to the platform it's being sent to. If you choose Binary it should leave it alone. As an experiment try FTP'ing one of these files in Binary mode and see if you get the extra carriage return.

snouter
01-12-2010, 06:46 PM
In FireFTP: Tools -> Options -> Downloads/Uploads

Tools is at the upper right corner.

The default is Binary.

You can set it to ASCII there.

WA
01-12-2010, 09:58 PM
Thanks guys. I was using "auto" mode when transferring files, with most known text file types set to transfer as ASCII (ie: txt, .js, .html etc). I believe I've found the problem- when setting these files to download as binary, the issue is gone. Does anyone know why transferring as ASCII for text files causes the downloaded files to contain those inadvertent line breaks?

Spookster
01-13-2010, 07:39 AM
Well for text files they should always be transferred in ASCII. That lets the FTP server know to convert the files. You would only use binary for files where CRLF does not apply like graphics files or executables for example since it can corrupt those files. I just suggested transferring your text file in binary mode to see if your FTP server would leave it alone as it is suppose to. If you do just transfer those files in binary you may want to run the dos2unix command on them once they are on the server assuming you have shell access. This would also do the conversion.

Also I would try transferring one of those files using another FTP client and see if you have the same problem. This would help to narrow down the problem on whether it's with the client or the server. I'm guessing either your client is not correctly identifying the platform it's on or the server is not converting things correctly.