Home » Questions » Computers [ Ask a new question ]

What's the point of ASCII mode in FTP?

What's the point of ASCII mode in FTP?

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?

Asked by: Guest | Views: 58
Total answers/comments: 3
Guest [Entry]

"When in doubt, read the RFC:

File-structure is the default to be
assumed if the STRUcture command has
not been used but both file and record
structures must be accepted for ""text""
files (i.e., files with TYPE ASCII or
EBCDIC) by all FTP implementations.
The structure of a file will affect
both the transfer mode of a file (see
the Section on Transmission Modes) and
the interpretation and storage of the
The ""natural"" structure of a file will
depend on which host stores the file.
A source-code file will usually be
stored on an IBM Mainframe in fixed
length records but on a DEC TOPS-20 as
a stream of characters partitioned
into lines, for example by <CRLF>. If
the transfer of files between such
disparate sites is to be useful, there
must be some way for one site to
recognize the other's assumptions
about the file.

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."
Guest [Entry]

ASCII mode had its place back in the day when character and EOL encoding was a real problem, but I would like to see ftp clients remove or perhaps just hide this option today. Nowdays it's mostly just EOL conventions that get messed up between systems, but I've found most decent text editors don't care anymore anyway. So in order to avoid corrupting binary files (or even some text based ones), I recommend just using binary mode for everything.
Guest [Entry]

"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"")."