ID: 27671 Comment by: nelson_menezes at hotmail dot com Reported By: venkateshp_2004 at yahoo dot com Status: Open Bug Type: Output Control Operating System: windows 2000 PHP Version: 5CVS-2004-03-24 (dev) New Comment:
This is not a bug; it's normal behaviour. Windows notepad works with the standard windows text-file format, which requires two characters for new lines (carriage return + line feed). Most other OS's only require line feed. If you use Wordpad (which supports unix-style endlines) instead of Notepad you'll see everything is as it should. Replace with these lines in your code: echo "\r\nThis is the test-line1\r\n"; echo "\r\n this is the test-line2\r\n"; Notepad should then show what you want. Previous Comments: ------------------------------------------------------------------------ [2004-03-24 08:04:12] venkateshp_2004 at yahoo dot com Description: ------------ Hi..! When i write the contents of the buffer which contains the data from ob_get_contents() in a file, Instead of '\n' I am getting the unknown charecter when i opend with the the file by using notepad.It is creating big problem when make CRC32check of the two files.I would be thankfull to you if you could solve it. yours, venki Reproduce code: --------------- <?php ob_start(); echo "\nThis is the test-line1\n"; echo "\n this is the test-line2\n"; $data=ob_get_contents(); $filename="test.txt"; $handle=fopen($filename,"a+"); fwrite($handle,$data); ?> Expected result: ---------------- In the file "test.txt" I am expecting the following contents in the file when i opend with the notepad (not with the php editor). This is the test line1 This is the test line2 Actual result: -------------- But i am getting some unknown symbol like this... 0This is the test line1 00This is the test line20 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27671&edit=1
