Author Topic: USE ASCII MODE FOR HTML TRANSFER RATHER THAN BINARY MODE  (Read 5523 times)

Offline Prince

  • Administrator
  • Honorable
  • *****
  • Posts: 32,948
  • Country: ng
  • Gender: Male
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 3.0.5 Firefox 3.0.5
    • View Profile
USE ASCII MODE FOR HTML TRANSFER RATHER THAN BINARY MODE
« on: January 20, 2009, 07:18:12 AM »
Use ASCII mode for HTML FTP transfers

TIP: Transfer HTML documents and other text-based files in ASCII mode, and transfer graphics, sounds, and executable programs in BINARY mode


When uploading or downloading HTML files using an FTP (File Transfer Protocol) program, always use ASCII mode rather than BINARY. The reason for this is that different operating systems vary in how they represent line breaks. MS-DOS and Windows systems use a carriage return followed by a linefeed (ASCII characters #13 and #10) at each line break, which is the traditional standard dating back to 1960s Teletypes which needed both characters to get the terminal to both move the carriage to the left margin and move down a line. Developers of some operating systems have decided that this is wasteful and a single character would suffice, but unfortunately they weren't consistent: UNIX ended up using a linefeed (#10) alone (which Unix developers refer to as a "newline" character), while Apple computers (both the old Apple II line and the Macintosh) chose the opposite course of using a carriage return (#13) by itself.

The result is that there are three different ways of denoting the end of a line, and software can fail if faced with a file that is delimited in a manner different from your operating system's convention. For instance, Windows Notepad will discard all line breaks if they're nonstandard, producing a file that's all on one line. (Perversely, this Notepad bug doesn't show itself until you've first loaded the file, which looks fine initially, then saved it; at that point, the line breaks collapse so the next time you load the file it will be messed up.) To avoid these problems, the FTP protocol was developed with an "ASCII mode" that converts line breaks to the appropriate style for the destination system. When you're sending from a UNIX server to a Windows PC, it adds a carriage return before each linefeed. Transferring the other way, it strips the carriage return. Transferring from UNIX to a Mac, it converts the linefeeds to carriage returns. Thus, the integrity of the file is maintained no matter what systems it's transferred between.

It's possible that file transfers in ASCII mode may perform other conversions depending on your system. Perhaps special extended characters will be converted from your system-specific values to the ISO standard. If so, this may enable you to edit text files with special characters in your word processor and store them in a manner that works on the Web, but watch out for unwanted conversions of characters you didn't want to alter. Check your FTP program's documentation for details.

Be sure to use BINARY mode instead if transferring non-text-based files such as graphics, sound files, and executable programs. Most FTP programs let you set extension recognition to use the proper mode for different file types. Set it to use ASCII mode for .htm, .html, and .txt files, and any other text-based files you may be using: style sheets (.css), image-map data (.map), CGI scripts in PERL or UNIX Shell (.pl, .sh, .cgi), program source code (.c, .h, .pas, .java), etc., and use BINARY mode for everything else (.gif, .jpg, .jpeg, .exe, .wav, .class, etc.)

Advertisements


Nigerian Best Forum . NBF

USE ASCII MODE FOR HTML TRANSFER RATHER THAN BINARY MODE
« on: January 20, 2009, 07:18:12 AM »

Enter Your Email Below For Daily Jobs Updates, It's Free

100% Free


 

ads

Enter Your Email Below For Daily Jobs Updates, It's Free

100% Free