TechTutorials - Free Computer Tutorials  







FTP: Binary or ASCII? Hot
 


Added: 08/18/2003, Hits: 4,058, Rating: 0, Comments: 0, Votes: 0
Add To Favorites | Comment on this article
Most people with FTP experience know that you need to set your FTP client to the correct transfer mode for the type of file you are sending, however, sometimes it is difficult to know whether a file is ASCII or binary. This tutorial will provide some information that will help you make this determination.

So why do you need to know if a file is ASCII or binary? If you FTP files using an incorrect transfer mode setting, they will not work correctly. If you would like to test this for yourself, try uploading a .exe file in ASCII and then try to execute it or a .jpg file and see if you can view the image. Its not going to work. Most FTP clients have an "Auto" mode which will try to determine for you whether the file you are trying to upload is ASCII or binary and then switch transfer modes automatically. The problem is that auto mode doesn't always work correctly. The reason for this is that the manufacturer creates a list of files to be transferred via ASCII mode. As an example, WS_FTP LE's help file states the following:

Quote :

(Startup) Transfer Mode: Automatic Detect

When selected, all files are transferred in binary mode unless the extension is listed on the Extensions tab. (WS_FTP Pro stores the ASCII extensions in the ws_ftp.txt file).


But what if your text file doesn't have .pl or .cgi listed in the configuration file? Well, you will have problems. If you are diligent about adding known ASCII file types to this list, then you will probably be alright using the Auto Detect mode, but you still need to be able to figure out which extensions are ASCII and which are binary. So let's get to that now.

ASCII stands for American Standard Code for Information Interchange. ASCII files are simple text files that have no formatting embedded in the document. For this reason, they can be viewed and printed regardless of application or platform. ASCII is made up of the English alphabet, numbers, punctuation and special characters such as $, *, % as examples.

Binary files, on the other hand, are typically application specific and platform dependent. Binary files contain embedded control characters that tell the application(s) that support that particular file type, what to display. Below is a small snippet of binary code. You can see from this that it is unreadable and uses a lot of non standard looking characters.

Code :

q}+D)7l5KB?beJo%Lc>ts!0nV)MC3Yyy+'3


Compare that to the ASCII text below.

Code :

|||1036281269|1:1|1.000|0|0|1|33|33|F7VKSUIHT7GrI|'<F]R;6-S90``|0|0|0| | |


Do you see the difference? Even though the ASCII text looks like a bunch of unreadable characters as well, notice that they are all common characters that we are used to seeing. In order to check out the format of a file that you are unsure of, simply open it in Notepad or other text editor and then check the code to see if it appears to be made up of ASCII characters or not.

Next is a listing some of the common file types that you may find yourself transferring with FTP.

ASCII:
.asp
.cgi
.css
.hqx
.htm
.html
.js
.php
.pl
.shtml
.text
.txt

Binary:
.fla
.gif
.jpg
.eps
.exe
.dll
.zip
.z
.gz
.tar
.sit
.sea
.png
.wav
.swf
.tiff

Can be either:
.bak - usually binary, but depends on system
.dat
.doc - Binary for MS Word documents





Comments (0)

Be the first to comment on this article


Related Items








7 Seconds Resources, Inc.




IT Showcase