Line Breaks in dynamic Download

From: Date: Fri, 06 Sep 2002 18:48:03 +0000
Subject: Line Breaks in dynamic Download
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-115536@lists.php.net to get a copy of this message
I have a script that allows clients to download their email lists from a database. However I can not get the 'new line' characters (\n \r) to do their job in Notepad when the download is prompted and the file saved to disk. I've simplified the problem with the code below. Both \n and \r display as 'null' or undefined characters in Notepad. What am I doing wrong? <? $file = "LINE ONE\nLINE TWO\rLINE THREE\n\r"; header("Cache-control: private"); header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=TEST.txt"); echo $file; ?> http://www.helpelf.com/texttest.php Click here to run this code. You should be prompted to save the file. Open the resulting file in Notepad on your PC. Tell me if the newlines show as 'null' characters or if each LINE ONE, LINE TWO, etc. shows up on their own lines. Mac users also welcome to try in Simpletext/BBedit. Much thanks, Kevin Stone kevin@helpelf.com

« previous php.general (#115536) next »