|
There are two ways of transferring files: ASCII and Binary.
Binary Transfer Mode
In Binary mode a file is copied bit for bit from one machine to the other. Both files (the
original and the transferred file) will contain exactly the same sequence of bytes.
ASCII Transfer Mode
In ASCII mode a file may be changed slightly to maintain the meaning of EOL (End Of Line)
characters.
Okay, but why?
There are two common ways of ending a line in an ASCII text file. UNIX systems mark the
end of a line with a single character - a linefeed or newline (LF or NL). DOS (and Windows)
uses a pair a characters instead - a carriage return (CR) followed by a linefeed.
In order to preserve the meaning of these ends of lines when transfering files, the end of line
characters have to be changed. When going from UNIX to DOS, LF's have to be replaced with
CR/LF pairs. Similarly, when going from DOS to UNIX, CR/LF pairs have to be changed to a
single LF. That is the difference between them.
I believe that Macs use a single carriage return character.
In a UNIX text file, carriage returns are just like any other character (except that you can't
usually see them). If you transfer a text file from DOS to UNIX as a Binary file, it will
have carriage returns (which sometimes look like ^M or a rectangle) on the end of each line.
Choosing a mode
In general Web pages and Perl scripts are ASCII text whilst images and programs are Binary.
ASCII (text) files:-
Files named .cgi, .pl, .pm, .txt, .php, .shtml, .html and .htm
Binary files:-
.au, .aiff, .bin, .doc, .exe, .gif, .gz, .jpg, .jpeg, .mpg, .mpeg, .mov, .pdf, .ps, .qt, .tar,
.tiff, .tif, .wav and .zip
|