Re: Form Post to different domain
| From: | Matijn Woudt | Date: | Thu, 16 Feb 2012 15:57:05 +0000 |
| Subject: | Re: Form Post to different domain | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316619@lists.php.net to get a copy of this message | ||
On Thu, Feb 16, 2012 at 4:09 PM, Daniel Brown <danbrown@php.net> wrote:
> On Thu, Feb 16, 2012 at 09:53, Tedd Sperling <tedd.sperling@gmail.com> wrote:
>
> This means you can rest assured that the newlines will be
> appropriate for the system on which PHP is running. While it makes
> little difference on the web, it makes a world of difference at the
> CLI and when writing to plain-text files (including CSV). I've been
> using it out of the force of habit for about seven years or so, and
> exclusively (with the exception of email headers and other warranted
> cases) for the last four.
>
What if the system PHP is running on not the same one as the one that
is going to read the plain-text/CSV/.. files? I don't think it is good
practice to use it when writing to files. I often write files on a
Linux server that people are going to read on a Windows PC.
Apart from that, most software written in the last 5-10 years will
happily read files with either \n or \r\n line endings. I'm not really
sure about Win XP for example, but if it would have a problem with the
Linux \n endings, it might even be better to *always* use \r\n line
endings (except where standards require it), as I haven't seen a
single Linux application since I started using it (about 9 years ago)
that was not able to read a file with \r\n based line endings.
Even better, go Unicode. Unicode specifies that there are 8 ways to
make a new line, and they should all be accepted. However, the pretty
uncommon NEL, LS and PS are not supported in many applications.
(though CR, LF and CRLF are).
- Matijn