RE: [PHP-DEV] PHP 4.0 Bug #5646: fwrite() in CGI php.exe doesn't make a CR/LF for "\n" but just a linefeed char
| From: | joel at intwebservices dot com | Date: | Mon, 17 Jul 2000 21:58:42 +0000 |
| Subject: | RE: [PHP-DEV] PHP 4.0 Bug #5646: fwrite() in CGI php.exe doesn't make a CR/LF for "\n" but just a linefeed char | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-24830@lists.php.net to get a copy of this message | ||
Well I did a bit of checking about that on the web.
\n is a newline.
Here is what I found from a Perl reference at:
http://www.google.com/search?q=cache:www.activestate.com/ActivePerl/docs/lib /Pod/perlport.html+cr/lf+windows+unix+convention+rule&hl=en
---------------------
In most operating systems, lines in files are terminated by newlines. Just what is used as a newline may vary from OS to OS. Unix traditionally uses \012, one type of DOSish I/O uses \015\012, and Mac OS uses \015.
LF == \012 == \x0A == \cJ == ASCII 10
CR == \015 == \x0D == \cM == ASCII 13
| Unix | DOS | Mac |
---------------------------
\n | LF | LF | CR |
\r | CR | CR | LF |
\n * | LF | CRLF | CR |
\r * | CR | CR | LF |
---------------------------
* text-mode STDIO
-----------------------------------------------------------------
Since this is about the PHP CGI for Windows it is my understanding that the windows convention for a Newline \n is CR/LF for text mode IO.
joel@intwebservices.com
At 05:01 PM 7/17/00 -0400, you wrote:
Correct me if I'm wrong, but isn't \n just LF while \r is CR? So if you want CR/LF you need to do: $dataStr="text data"."\r\n"; $writeSuccess=fwrite ($textFilehandle, $dataStr); If it "worked" in the ISAPI module version, I suspect that the real bug report would be that fwrite was adding characters to the output when it runs as ISAPI. Tim -----Original Message----- From: joel@intwebservices.com [mailto:joel@intwebservices.com] Sent: Monday, July 17, 2000 4:42 PM To: php-dev@lists.php.net Subject: [PHP-DEV] PHP 4.0 Bug #5646: fwrite() in CGI php.exe doesn't make a CR/LF for "\n" but just a linefeed charFrom: joel@intwebservices.comOperating system: WINDOWS NT 4.0PHP version: 4.0.1pl2 PHP Bug Type: Misbehaving functionBug description: fwrite() in CGI php.exe doesn't make a CR/LF for "\n" but just a linefeed char $dataStr="text data"."\n"; $writeSuccess=fwrite ($textFilehandle, $dataStr); The log file will have just a HEX "0a" char instead of HEX "0D 0A" . It worked ok for the ISAPI module but when I switched to the CGI php I noticed the difference. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net