Why is there an ASCII mode in FTP, which is prevalent in today's software and FTP implementations? Why not just always use binary regardless of the data?
migrated from stackoverflow.com Jul 16 '09 at 2:09
|
When in doubt, read the RFC:
etc etc ... In short, it is to ensure that text representations in one encoding got converted properly when transferred to hosts using a different encoding. |
|||
|
|
|
Because different operating systems (Windows, UNIX, VAX) use different line ending methods for simple text files. Windows (DOS) uses a CR/LF pair, UNIX uses only one of them. ASCII mode converts CRLF pairs and BIN mode doesn't. Ron |
|||||
|
|
I think it's just because it sometimes is convenient. Back in the day when FTP was how you got files from one system to the next, it was a big timesaver -- you didn't have to know what the system was on the other end in order to have a readable text file. But yeah, mostly it's just a nuisance today. Just a corrupt-o-matic machine for the uninitiated! |
|||
|
|
|
ASCII mode is used so that the software can automatically change EOL characters to the proper values for the client/server depending on if you are uploading/downloading. If you are uploading to the same type of system as you are using, there is no difference in these modes. The reason for this mode though is because not all software on all systems will correctly handle EOL's that aren't the exact proper type of EOL (for instance, alot of Windows software will only handle "\r\n" properly and will balk something horrible on "\n"). |
|||
|
|
|
Some nice explanation here http://courses.wccnet.edu/computer/mod/na36c.htm Please read the section 'ASCII and Binary in FTP' cheers |
|||
|
|
|
The shortest answer is that this was (literally, I think it preceded telnet) the first app written for the ip protocol suite, and they had nothing to steal from. :-D But seriously, look at some things, like the way the data connection is set up, and that it runs on it's own port, but you cannot use the terminal session for anything (like, say, queuing up the next file). |
|||
|
|
|
The original reason was to decrease transmission sizes (and times) by 1/8 (since ASCII uses 7 bits, and binary uses all 8 bits). 20+ years ago this resulted in significant time savings over modem. Today, everything can just be sent binary, and the ascii mode is there for backwards-compatibility. |
|||
|
|