Your best friend for file transfer.

Fetch application logoFetch

text files sent via ascii or binary mode (2 posts)

This is an archived topic. The information in it is likely to be out-of-date and no longer applicable to current versions of Fetch.
  • Started 14 years ago by amleo
  • Latest reply 14 years ago from Jim Matthews
  • amleo Member

    What happens to text files when they are sent in binary mode? Is there a reason that there are two FTP transfer modes? Does FTPing a text/ascii file in binary mode damage it? If you know of a 3rd party URL that deals with this topic, please let me know?

    Posted 14 years ago #

  • Jim Matthews Administrator

    When FTP was invented they made a distinction between ASCII (aka text) and image (aka binary) transfers because text files were among the most commonly transfered, and different systems stored text files in different ways. One difference, and the main one that remains to this day, is the way that line endings are stored. For example, UNIX indicates a line ending with a linefeed (LF) character, Macs use a carriage return (CR), and DOS, Windows and VMS use both (CR followed by LF). The other differences had to do with operating systems that store text files in special formats, for example formats with a fixed number of characters per line. Examples include IBM's VM/CMS mainframe operating system. For most people using FTP today that problem isn't much of an issue.

    To make it possible to share text files between machines with different local formats, the FTP protocol specifies that text files should be transferred with CRLF linefeeds. So an FTP program in ASCII or text mode translates files it is sending to that format, and translates files it is receiving from that format to the one used locally.

    Transferring a binary file in text mode will almost certainly damage it. The FTP program will see characters that look like line-ending characters in the binary data, and replace them with CRLF. That translation is not generally undoable.

    Transfering a text file in binary mode will not cause data loss, but it might result in a file that doesn't look right at the destination. For example, if you transfer a Mac text file to a Unix server in binary mode, and ask the Unix "cat" program to type out the file, it will type it all out on one line. If you transfer a Windows text file to a Mac and open it in, say, SimpleText it will have funny box characters at the beginning of each line. Fortunately more and more software is becoming more flexible about line-ending characters. So a good text editor like BBEdit will display a file correctly no what the line endings are, and can translate between the three common formats (Unix, Mac and DOS).

    I hope this helps answer your question.

    Jim Matthews
    Fetch Softworks

    Posted 14 years ago #

Topic closed

This topic has been closed.