Thankyou Ross, (may I call you Ross?) :-)

Worked a treat. The correct order is \r\n (\n\r just produces 2
undisplayable characters [][]).

I had tried \n\r but hadn't considered using \r\n.

Thankyou Thankyou Thankyou

Henry

"Ross Fleming" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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
>
> R
>
> Henry Grech-Cini wrote:
>
> > Dear All,
> >
> > Firstly, I am a newbie to php so please be gentle.
> >
> > I'm having problems with carriage returns placed in a file on a Linux
based
> > server. When this file is download to a WindowsXP machine the carriage
> > returns are quite frankly useless. I just get "[]" (where "[]"
represents an
> > undisplayable character. No actual carriage returns or newlines!
> >
> > I generate the file using the following code (fragment only):
> >
> >  while($row=mysql_fetch_array($mysql_result))
> >     {
> >       $f_title=$row["title"];
> >       $f_first_name=$row["first_name"];
> >       $f_surname=$row["surname"];
> >       $f_email=$row["email"];
> >       fputs($file_op,"$f_title, $f_first_name, $f_surname, $f_email\n");
> >     }
> >
> > I then use the following link to a download_it.php script as described
in
> > Tansley as follows:
> >
> > $parameters="file_name=".urlencode($file_name)."&file_size=$file_size";
> >  echo "<A HREF=\"downloadit.php?$parameters\">download it</A>";
> >
> > The download_it.php file looks as follows:
> > <?php
> > #downloadit.php
> > $file_name=urldecode($file_name);
> > header("Content-type: Application/octet-stream");
> > header("Content-Disposition:
attachment;filename=download/download.txt");
> > header("Content-Description: PHP Download");
> > header("Content-Length: $file_size");
> > readfile($file_name);
> > ?>
> >
> > Appart from the fact that the Content-Disposition appears not to be
working
> > under IE6 since the file name is not correct.
> >
> > The downloaded file does not contain Windows type carriage returns of
> > newlines! However it does contains the data thank goodness.
> >
> > What is the fix?
> >
> > Henry Grech-Cini
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to