Either your file is a "binary" file, that is, it contains "non-printable" characters or it is an "ascii" file, that is, it contains "printable" characters (letters, numbers, special characters, punctuation symbols).
- You cannot "change" a binary file to ascii file (or vice versa) to make it usable.
- You can open a binary file in a text editor (most of them allow it), but all you see is a mess of jumbled up characters e.g. try opening a ".exe" file in Windows using a text editor, or a ".so" file in Unix using a text editor.
You are probably transferring files (using ftp) from, say Unix/Linux to Windows or vice-versa and you want to ensure that a binary or ascii file is transferred properly. ( That is important because newline characters in different OSes are different, hence they need to change when you transfer files. ) That's when "transferring in binary/ascii mode" comes into picture.
- A binary file must be transferred in binary mode and an ascii file in ascii mode. Most of the Windows-based GUI FTP programs automatically detect the file type and use appropriate mode.
- However, if you are using the old-school "ftp" command line in Windows or Unix/Linux, then you will need to specifically set the mode to binary or ascii. Just type "binary" or "ascii" at the ftp prompt. You will see an informative message. And then you can transfer the appropriate file. See below:
C:\> ftp
ftp>
ftp> open
Connected to
220-
220
User (:(none)): anonymous
331 Please specify the password.
Password:
230 Login successful.
ftp>
ftp> binary
200 Switching to Binary mode.
ftp> # now transfer binary file(s)
ftp> ascii
200 Switching to ASCII mode.
ftp> # now transfer ascii file(s)
ftp>
- In other GUI based FTP programs, check "Settings" or "Options" or "Preferences" from the menubar. It really depends on the individual tool.
- Your ".cgi" file is a binary file. You can open it in any editor (like Notepad, Textpad, vim etc.) but modifying the contents won't be of any use. If you are transferring that file to/from a remote system, ensure that the ftp mode is set to "binary".
Hope that helps.
Cheers !!
2007-01-11 16:54:02
·
answer #1
·
answered by techieguy 4
·
0⤊
0⤋