Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: bdiff |
| Date | 2011-06-20 19:14 +0000 |
| Organization | None |
| Message-ID | <969kgpFjduU2@mid.individual.net> (permalink) |
| References | <94mfhcFngqU1@mid.individual.net> <87boy6241i.fsf@blp.benpfaff.org> <95crfqF60lU1@mid.individual.net> <isrgpj$4qq$1@speranza.aioe.org> |
In article <isrgpj$4qq$1@speranza.aioe.org>, Alan Curry <pacman@kosh.dhis.org> wrote: > In article <95crfqF60lU1@mid.individual.net>, Uno <Uno@example.invalid> wrote: [ snip ] > FTP was invented when dinosaurs roamed the Internet. The dinosaurs growled, > roared, and screeched ASCII, which was presented to the users on hardcopy > terminals - typewriters, basically. That may be true of the dinosaurs that wanted to use this newfangled file transfer protocol, but some of them (I'm thinking of the ones made by IBM) mostly used another format, EBCDIC, for representing character data. Just sayin' (after a rather long delay, for which I apologize). > [If you're not old enough to have ever seen a typewriter, google up an image > of one now, or preferably a video of one in use.] Good heavens -- are they really people who have never encountered a typewriter at all? cue chorus of "I feel old", maybe .... [ snip ] > The dinosaurs were a rowdy bunch, and they fought over how to properly store > text on non-typewriter-like media (like tapes and disks), but they were all > able to understand the typewriter-like ASCII-with-CRLF format. It was the > universal text representation. And it was incorporated into FTP as the > standard format for transmission of text files. I just made a quick attempt to confirm my recollections about whether the IBM 360/370 architecture included support for ASCII, and -- it's kind of interesting that the Wikipedia articles say that the 360 architecture included some features intended to support ASCII (which had not been finalized), but that these were not used, or not used widely, and the 370 architecture dropped at least some of them. I wonder whether there was some consternation when it became desirable to support FTP, it being ASCII-based. (I'll leave the rest of this in because it's kind of charming.) > A bit later, UNIX was created. It was like a small mammal, hiding > underground, barely noticed and definitely not respected by the dinosaurs. > And the UNIX guys observed that text files on disk were becoming more > numerous than text printouts. And they said that soon typewriters as a user > interface would be obsolete, replaced by CRTs. and that eventually people > would send text to each other without even using paper. > > In such a future it would make no sense to keep using that old pair of > typewriter commands to separate lines of text. It would be much better to > take "end this line, begin next line" as a single logical operation and allow > it to be represented by a single control code. They called this new control > code "NEWLINE". It was a revolutionary idea. > > And the dinosaurs ignored it, and kept making up Internet protocols with > mandatory typewriter-style line endings. > > When later generations of UNIX got big enough to climb out of their > underground tunnels and talk to the Internet, they had a problem: all of > their private text files and utilities were designed around the NEWLINE idea, > but all of the Internet protocols, including FTP, required CRLF. FTP clients > and servers on UNIX have to perform translation. When sending a file, they > transform it from NEWLINE format to CRLF format. When receiving it, they do > the opposite. > > When sending a text file, UNIX FTP changes the file into the dinosaur > typewriter format by inserting a CR (13) before every NEWLINE (10). When > receiving a text, it changes each CRLF pair into NEWLINE. Note that it > doesn't have to actually look for CRLF pairs. It can just delete all the CRs, > since LF and NEWLINE have the same numerical value (10) and a CR that is not > part of a CRLF pair is not allowed. > > When those transformations are applied to things that aren't actually text > files, the result can be a disaster, because bytes with value 13 can > disappear, or can be added before bytes with value 10. The transformation > isn't reversible when the input contains unpaired CR or LF bytes. > > So your file got corrupted because you used ASCII mode FTP and you got caught > speaking ungrammatical dinosaur typewriter Esperanto. > > Use binary mode. (Technically, in the language of FTP, "TYPE IMAGE", but most > clients call it "binary mode") > > And yeah, you could have just googled "FTP binary" but I felt like writing a > story about dinosaurs anyway so here you go. -- B. L. Massingill ObDisclaimer: I don't speak for my employers; they return the favor.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
variable-length strings Uno <Uno@example.invalid> - 2011-06-01 03:36 -0600
Re: variable-length strings ccc31807 <cartercc@gmail.com> - 2011-06-01 07:13 -0700
Re: variable-length strings Uno <Uno@example.invalid> - 2011-06-02 10:54 -0600
Re: variable-length strings "George Mpouras" <nospam.gravitalsun@hotmail.com.nospam> - 2011-06-01 17:01 +0300
Re: variable-length strings "Peter J. Holzer" <hjp-usenet2@hjp.at> - 2011-06-02 15:33 +0200
Re: variable-length strings "Peter J. Holzer" <hjp-usenet2@hjp.at> - 2011-06-02 15:44 +0200
Re: bdiff Uno <Uno@example.invalid> - 2011-06-08 21:59 -0600
Re: bdiff Ian Collins <ian-news@hotmail.com> - 2011-06-09 16:08 +1200
Re: bdiff Uno <Uno@example.invalid> - 2011-06-08 22:20 -0600
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 02:57 -0600
Re: bdiff Janis Papanagnou <janis_papanagnou@hotmail.com> - 2011-06-09 11:10 +0200
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 13:19 -0600
Re: bdiff James Waldby <not@valid.invalid> - 2011-06-09 19:32 +0000
Re: bdiff Angel <angel+news@spamcop.net> - 2011-06-09 19:32 +0000
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 15:28 -0600
Re: bdiff blp@cs.stanford.edu (Ben Pfaff) - 2011-06-09 12:33 -0700
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 15:15 -0600
Re: bdiff pacman@kosh.dhis.org (Alan Curry) - 2011-06-09 22:17 +0000
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-20 19:14 +0000
Re: bdiff Robert Wessel <robertwessel2@yahoo.com> - 2011-06-20 18:43 -0500
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-21 20:39 +0000
Re: bdiff Joe Wright <joewwright@comcast.net> - 2011-06-21 18:38 -0400
Re: bdiff Robert Wessel <robertwessel2@yahoo.com> - 2011-06-21 18:11 -0500
Re: bdiff Michael Press <rubrum@pacbell.net> - 2011-06-22 15:51 -0700
Re: bdiff Stephen Sprunk <stephen@sprunk.org> - 2011-06-21 07:49 -0500
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-21 20:40 +0000
Re: bdiff superpollo <superpollo@tznvy.pbz> - 2011-06-22 09:59 +0200
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-22 19:57 +0000
Re: bdiff superpollo <superpollo@tznvy.pbz> - 2011-06-23 21:16 +0200
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-24 19:36 +0000
Re: bdiff superpollo <superpollo@tznvy.pbz> - 2011-06-24 22:48 +0200
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-24 21:17 +0000
Re: bdiff Robert Wessel <robertwessel2@yahoo.com> - 2011-06-24 17:20 -0500
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-22 19:55 +0000
Re: bdiff Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-21 21:40 -0400
Re: bdiff Azazel <azazel@remove.azazel.net> - 2011-06-22 09:06 -0500
Re: bdiff Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-06-22 16:47 +0100
Re: bdiff Stephen Sprunk <stephen@sprunk.org> - 2011-06-22 11:23 -0500
Re: bdiff Ike Naar <ike@sverige.freeshell.org> - 2011-06-09 21:37 +0000
Re: bdiff bonomi@host122.r-bonomi.com (Robert Bonomi) - 2011-06-19 06:10 -0500
Re: bdiff Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-09 07:13 -0400
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 13:30 -0600
Re: bdiff Keith Thompson <kst-u@mib.org> - 2011-06-09 13:29 -0700
Re: bdiff Uno <merrilljensen@q.com> - 2011-06-09 21:11 -0700
Re: bdiff "Morris Keesan" <mkeesan@post.harvard.edu> - 2011-06-09 23:58 -0400
Re: bdiff Uno <Uno@example.invalid> - 2011-06-12 00:47 -0600
Re: bdiff Angel <angel+news@spamcop.net> - 2011-06-12 07:53 +0000
Re: bdiff Shao Miller <sha0.miller@gmail.com> - 2011-06-12 12:02 -0500
Re: bdiff Keith Thompson <kst-u@mib.org> - 2011-06-12 01:24 -0700
Re: bdiff Shao Miller <sha0.miller@gmail.com> - 2011-06-12 12:18 -0500
csiph-web