This is an old revision of the document!
Transfer Modes
As different platforms (operating systems) uses different format of text files, many transfer protocols support special mode for transferring text files (called text or ASCII mode). In the mode the file is not only transfered, but also converted to format used by the target platform. The mode must not be used for binary files (inluding document files from modern text processors, like Microsoft Word), as they must be transfered without modification.
Advertisement
- Available Modes
- Server-side Text File Format
- Editing Binary Files
- Transferring Large Text Files with SCP Protocol
Available Modes
For the reason, WinSCP offers you chance to select between Text and Binary transfer modes. You can set the default transfer mode on Transfer tab of Preference dialog or change the mode for particular transfer only on transfer options dialog.
WinSCP has also special Automatic mode (default). With the mode WinSCP decides automatically about transfer mode for particular file based on its filename (usually extension part). The so-called text file mask can be configured in dialogs mentioned above. By default it includes HTML, TXT, PHP, XML, INI, C, CPP and other file types. You can modify the mask as you need. Files not matching the mask are transfered using Binary mode.
Server-side Text File Format
There are two options how to support text mode transfers. The first option is that the client (WinSCP) knowns directly the text file format used by the server and converts the file to the format before transfer. The second option is that there is some in advance agreed canonical format to which the client converts the file before transfer and from which the server converts it (if necessary) after transfer to its own format.
The second option is more universal, but it is supported only by SFTP protocol version 4 and newer.
The first option is used by WinSCP for SCP protocol and SFTP protocol below version 4. It this case the client (WinSCP) must directly know and support the server-side format. Generally there is plenty of text file formats, almost every platform has it own format. WinSCP supports two most used formats, Unix and Windows. You can select between them on Environment tab of Login Dialog. As most SSH servers are run on Unix system, generally you may leave the default Unix format.
Advertisement
Editing Binary Files
Learn how to edit remote binary file locally.
Transferring Large Text Files with SCP Protocol
Note that due to SCP protocol requirements WinSCP needs to know size of converted test file before the transfer actually starts. For the reason with SCP protocol, the whole file is converted in memory before the transfer.
If the file is too large (not common for text files), you can run out of memory during conversion. So to transfer large text file, either force binary mode (if possible) or switch to SFTP protocol.