Robert G. (Doc) Savage wrote:
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").
And on MacOS the convention is only <CR>. At least on the old MacOS; I don't know about programs for MacOS X.
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.
A much better way in my opinion, because that way you will convert only the files that need to be converted. The ASCII transfer mode is a misfeature of FTP, because it's far too easy to accidentally transfer non-text files in ASCII mode, which will totally and irreversibly trash them. This problem is so common that the file header of the PNG image format has been carefully crafted to make it easy to detect this kind of mangling.
Maintaining different conventions on different nodes in a heterogenous network is impossible anyway, so many modern text-processing tools recognize all variants of line breaks. If the CGI programs are to be run by a bigotted interpreter that only understands one line break style, then why not write them in a smart editor that lets you choose which style to save them in?
Björn Persson