12/22/2005

FileZilla ASCII and line endings

I've tried my small share of FTP programs, among them Filezilla. Thing is, I like to upload in secure mode (e.g., SFTP) when at all possible. And, while I loved Filezilla's ability to upload files utilizing PuTTY (that is, securely), I also noticed a problem when uploading .cgi scripts — namely, Perl scripts would stop working. Which you wouldn't necessarily notice for a while. :(

I finally discovered that, in secure mode, Filezilla was adding line endings to the lines of code, thereby rendering them invalid. I discovered this by SSHing in (with Putty) and editing the files via VI. This is what I saw:

line of code^M
line of code^M

… ad infinitum. While one *could* edit the files with VI to remove the line endings, that's hardly a convenient solution; no, uploading and being done with it is the convenient solution in my book.

I'd seen this seeming solution at Ringlink.org:

Personally I have just noticed that sometimes "ASCII transfer mode" does not work, and my own 'solution' is to ensure with my text editor that the files are saved in Unix mode *before* the transfer to the Unix environment.

This is in my opinion too much hassle. Text editors (I use NoteTab Pro) normally save in non-Windows no-line-endings mode; it's Filezilla in secure mode that was adding them. Upload a file in Filezilla — line endings. Upload the same unchanged file in a normal FTP program — no line endings. End of story.

Actually, the real end of the story is that I had switched from WS_FTP Pro because it had the same line-endings problems when uploading in secure mode. However, the latest versions do not. That's the end of the story, or at least, my story. :)

Added: Excellent series of pages from Indiana University regarding FTP and Mac and UNIX line endings

6 Comments to "FileZilla ASCII and line endings"

  1. Unixer says:

    Have you tried dos2unix ?
    You should take a look at it, it would do it for you !!

  2. Diane Vigil says:

    Interesting — dos2unix is a DOS/MAC to UNIX text file format converter.

    Since we're talking about uploading files to a server, I'm not sure that dos2unix would be my first choice. If I were going for a command line utility, I would likely use pUtTy.

    That said, I wrote this post in 2005, and FTP clients such as WS_FTP have long since solved this problem, even for SSH uploading.

    But thanks for the tip.

  3. John says:

    I'm having this problem with FileZilla's ascii files also.

    At the filezilla site, they simply say there's no way to deduce if the remote server is unix. That said, they have per-server settings. Why they don't want to add this information to the per-server transfer settings is unknowable. Can't shake the feeling though, that it's because they're tired of the whole project.

    e.g.,
    =======
    A simple solution for future versions would be to add a setting to the server settings (transfer section) that says what kind of line-endings the remote server uses for ascii files.

    Remote ASCII file line-endings
    o Don't convert
    o Window (crlf)
    o Unix (lf only)

    If the remote server is o Unix (lf only) then the conversion done on the D/L for ascii files can simply be reversed when uploading ascii files.

  4. Diane Vigil says:

    Good points. I've been using Ipswitch's WS_FTP for a long time. It allows you to set up multiple links(?) to the same domain (useful for going directly to different folders), and to specify what file extensions should be uploaded as ASCII, among other things.

    It's only $29.95 now: https://www.ipswitch.com/secure-information-and-file-transfer/wsftp-client#buy

  5. John says:

    My last post is OBE (Pay no attention to that man behind the curtain) :-)

    I've downloaded the latest version, and it permits selecting the OS type for each host you set up. It's in the Advanced tab (not the transfer tab), but I tested it, and it seems to work as you'd expect. That is, adds ctl-M on d/l and removes ctl-M on upload.

  6. Diane Vigil says:

    Excellent.

Have your say ...

First-time comments will be held for moderation (but comments are appreciated). Otherwise, just be courteous. If your name is a bunch of keywords, your comment will be deleted. Don't post links unless highly pertinent. Posters must be 16 or older.

Manage your subscriptions

Archives
© 2004-2017 DianeV Web Design Studio. All Rights Reserved.
34 queries. 0.264 seconds.