Re: Newline in file using fputs

From: Date: Thu, 16 May 2002 14:32:19 +0000
Subject: Re: Newline in file using fputs
References: 1 2 3  Groups: php.windows 
Request: Send a blank email to php-windows+get-13818@lists.php.net to get a copy of this message
B.A.T.Svensson wrote (possibly not visible as a post yet) > Are you trying to get line breaks on a web pages with CR/LF? > (IF so: it not possible, use the HTML tag "<br>" to induce a line break.) No I'm not trying to do that, I'm trying to generate a CSV file from a collection of tabels within a MySQL database. This .csv file is then downloaded to a windows machine. Any suggestions? Henry "Henry Grech-Cini" <henryg@markiteer.com> wrote in message news:20020516141207.77184.qmail@pb1.pair.com... > Dear All (and B.A.T.Svensson in particular) > > I agree. It should not be necessary with a proper language. Could it be that > I need to use a different header as opposed to: > > header("Content-type: Application/octet-stream"); > > In anycase doing TrimRight() and adding on a "\n" did not work! > > Henry > > > "B.A.T. Svensson" <B.A.T.Svensson@lumc.nl> wrote in message > news:000601c1fce1$3e9fb660$ce411eac@5-hkg-01-1234.lumc.nl... > > > Congratulations on discovering the difference between windows and linux > > > carriage returns. :) There are 2 types of new-line character, \r > (carriage > > > return, ie move the cursor back the the left hand side of the screen) > and \n > > > (new line, strictly interpreted as "move cursor down one line, but not > > > along"). Linux quite happily accepts \n as, "new line and return cursor > to > > > left home" however windows needs both, \n\r (or vice versa, I'm not sure > > > which). Linux fortunately will accept \n\r as a single return, so feel > free to > > > always put \n\r > > > > A proper language should interpret \n into the correct CR (new line) code > at the > > target platform. hence: don't fiddle around with \r or \f and that shit. > Just do > > a TrimRight() and add on a "\n" (new line) at the end - should be > enough... > > > > By the way. Windows uses 0x0D0A as CR, eg char(13) and char(10), in that > order. > >

« previous php.windows (#13818) next »