Archived Forum Post

Index of archived forum posts

Question:

How to set ASCII Mode in chilkat SFTP component ?

Jun 19 '15 at 09:07

How to set ASCII Mode in chilkat SFTP component ?


Answer

The "SFTP" protocol is Secure File Transfer over SSH. It is a protocol entirely unrelated to the "FTP" protocol. The only thing they have in common is the purpose of uploading and downloading files. It should never be assumed that particular features or concepts that exist in FTP would also exist in SFTP. For example, one can upload or download files using the HTTP protocol, but nobody ever asks for "ASCII" mode in HTTP, and nobody ever asks how to "change the remote directory" in HTTP. This is simply because the name "HTTP" makes it more clear that it is not "FTP". Likewise, "SFTP" is not "FTP". It is no more like FTP than HTTP. Certain application programs, such as FileZilla, may present a unified user interface for both SSH/SFTP and FTP, but under-the-covers, they are implemented entirely differently, each to particular model as defined by the protocol.

That being said.. the SFTP protocol defines a "textMode" disposition that can be specified in the args to the OpenFile method. I don't know if all SFTP servers pay attention to it, but it's something one can try to have the server automatically convert line-endings to the customary LF or CRLF depending on the server operating system..

ASCII mode was present in the FTP protcol because the FTP protocol is a very old protocol. EBCIDIC was common way back when.. and one reason for the mode was to convert EBCIDIC to/from ASCII. Nowadays, EBCIDIC is not common and essentially ACSCII mode is for line-ending conversion (CRLF on Windows, and bare-LF on everything else.)