Originally Posted by clvic
I had a problem with the old good ascii/binary FTP transfer modes.
I transferred some files (SQL scripting files, in which carriage returns DO matter) using FTP from a windows system to a linux system using filezilla "auto" mode, that should have resulted in ASCII mode for my sql files. These files are well formed and identical to the originals.
Then, someone else picked these files and moved them to another ftp server.
I finally found that all <CR><LF> couples have been transformed in <CR><CR><LF>.
I guessed that the problem was in the ASCII transfer mode - but, how comes that <CR><LF> => <CR><CR><LF>? I would have rather expected <CR><LF> to become <CR>.
I hope I've been clear, thanks to everyone that will answer!
It is easier to solve a problem like this than to try to diagnose it. Write a script that finds line endings (of any kind) and converts them to your preferred line ending. Regardless of the script language, the essential regex looks like this:
... before using this method, make sure there are no intentionally blank lines (e.g. multiple line endings with no intervening text) such as one finds in plain-text documents. For that case, you really do need to specify the exact line ending you are looking for:
Again, this is an example where a cure is much easier than a diagnosis.
I would have rather expected <CR><LF> to become <CR>.
Only on a Macintosh:
Linux/most Unices: \n