Page 1 of 1
AUTO detection for ftp ascii/binary transfer mode
Posted: 07 Apr 2006, 00:10
by Richard_Browne
I need AUTO mode for ASCII/BINARY transfer selection. Every other ftp client has it.
Or at *least* make ASCII/BINARY selectable from the copy options. Making it a based on file name masks is no good, for me anyway.
Posted: 07 Apr 2006, 08:43
by Petr Solin
You can change transfer mode in context menu (right click in panel with FTP connection) or in menu Plugins > FTP Client > Transfer Mode. You can also display plugins toolbar (menu Options > Show > Plugins Bar), then click on FTP Client button > Transfer Mode.
Automatic transfer mode is driven by file masks as in all other FTP clients I have seen. If you have better idea, let me know.
Moreover our FTP Client detects unwanted ASCII mode for binary files (message is displayed + you can switch to binary mode).
Posted: 11 Apr 2006, 00:10
by Richard_Browne
Hi Petr
My suggestion is to look inside each file and determine whether it's binary or text, and forget about file extensions. They can never be relied upon. Often I transfer files without any extension - some are text and some are binary. Since you are already detecting incorrect transfer ascii mode for binary files, it seems it would be possible.
I didn't know about the context menu or toolbar, so that's good to know.
Posted: 11 Apr 2006, 03:25
by SvA
There is absolutely no way to reliably judge from content whether a file is text. You can quite reliably judge some files to be binary, though.
Binary transfer is lossless, text transfer is lossy. So if in doubt, the transfer agent should use binary transfer.
Posted: 11 Apr 2006, 08:59
by Petr Solin
SvA wrote:There is absolutely no way to reliably judge from content whether a file is text. You can quite reliably judge some files to be binary, though.
Yes, it's always guessing (heuristics), so we cannot use it as Richard suggests. Moreover it would rapidly slow down all transfers (in worst case twice). That's because it means to download at least part of file in binary mode and then if it's detected as text file, download it whole again in text mode.
BTW, in fact FTP Client already can do it as you suggest: you can set ASCII mode as default (FTP Configuration > Defaults) and set "Use Binary Mode" in FTP Configuration > Operations 1 & 2 for "if ASCII mode is set for file with binary content". The difference is that all files are downloaded in ASCII mode (not in Binary) for testing if file content is ASCII or binary, but this could not be problem (it should change only line-end characters which are not important for binary/ASCII resolution).