FTP Binary , ASCII

Robert G. (Doc) Savage dsavage at peaknet.net
Sun Aug 22 22:46:14 UTC 2004


On Sun, 2004-08-22 at 17:19, littleguru wrote:
> Hello
> 
> I as reading a book related to cgi scripts , and it mentioned that we 
> shouldn't upload
> scripts through Binary mode , because they will not work .
> Would you please explain to me what is the difference between these two 
> , when is the
> best time to upload with each of them .

MS-DOS/Windows editors end all lines of text with <CR><LF> pairs, while
UNIX text uses only single <LF> characters (a.k.a. <NL> or "new line"). 

If you edit a UNIX script on a DOS system, the embedded <CR> characters
will prevent it from running correctly when it's copied over to a UNIX
system using an exact binary transfer.  When in the default ASCII
transfer mode, the ftp command line client will insert or strip carriage
return characters associated with line feeds, depending on which
direction the file is being transferred.

An equivalent way to make sure there are no embedded <CR> characters in
a UNIX script is to use the 'dos2unix' utility on it after receipt.

-- Doc 
Robert G. (Doc) Savage, BSE(EE), CISSP, RHCE | Fairview Heights, IL
Fedora Core 1 kernel 2.4.22-1.2199.nptl on P-III/M IBM Thinkpad A22p
"Perfection is the enemy of good enough."
                         -- Admiral of the Fleet Sergei G. Gorshkov





More information about the fedora-list mailing list