Jump to content
Guest Kronzy

FTP: Binary or ASCII?.

Recommended Posts

Posted

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:


(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.

 ùqÌ}+¬ÉD)7lü5ÜKÐÐB×ç’É?ébeJáoêÕ*ùå¬íÆ%ëLácÛ>çÏÃôŠtsÄ!Ÿ¡¨0ünVü)MöC3Yyy+ì'3¡

Compare that to the ASCII text below.

 |||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

Source: TechTutorials - Free Computer Tutorials :: FTP: Binary or ASCII?

Posted

O problema frecventa pe care o intalneam la transferul in modul ascii era ca dupa ce puneam un fisier pe server si il descarcam din nou avea cate o linie goala dupa fiecare rand de cod. Asta nu se intampla daca treceam in modul binar.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...