Re: Newline in file using fputs
| From: | Henry Grech-Cini | Date: | Thu, 16 May 2002 14:12:40 +0000 |
| Subject: | Re: Newline in file using fputs | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13817@lists.php.net to get a copy of this message | ||
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.