On Fri, Apr 13, 2007 at 09:37:14AM -0400, stuart van Zee wrote:
> Sorry if this belongs elsewhere but I was sure someone here would know.
>
> I was under the impression that when using SFTP to transfer files they
> were automatically treated as Binary files. So if the remote file uses
> CRLF to terminate lines, the downloaded file would have CRLF terminating
> it's lines. So I have a vendor that has replaced his FTP with SSH/SFTP.
> my code is written to expect CRLF because that is the way the files
> were when using the old FTP system to download. Now, when I use SFTP
> the files just have the LF. The vendors answer is that we need to use
> ASCII mode to transfer the files to get the CRLF. I didn't know that
> there WAS an ASCII mode in SFTP let alone that using ASCII as opposed to
> Binary would change the line terminators. The files in question are
> technically ASCII text files but shouldn't I be getting an EXACT copy of
> the file when I use Binary mode (assuming that I am right and that is
> indeed the default with SFTP)?
>
> What I really need is an explanation or a pointer to where I can get an
> explanation so that I really know what I am talking about when I talk
> to this vendor (and KNOW that I know what I am talking about).
The sftp(1) man page is the canonical source, which doesn't contain
ASCII mode, but given that they aren't exactly clued, why not just put a
filter in there? I'm sure there are at least a thousand utilities or
easily-written scripts that can do this.
(On another note, ftps - ftp over SSL - does have an ASCII mode. It's
also incompatible with pretty much anything and best replaced by
something vaguely modern - say, sftp.)
Joachim
--
TFMotD: netintro (4) - introduction to networking facilities