dlite922 Posted July 10, 2007 Share Posted July 10, 2007 have loaded apache and php 5 on xp pro. don't know why this is happening but when i write to a file, the new line (line break) '\n' character does not show up as a line break but as a square (which is the "unknown symbol" symbol) here's the little tiny code from tigzag tutorials basically copy and pasted. my original application is to find all mp3's in a directory. and let the user build a .m3u playlist and handed over to an embedded windows media player. $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "Bobby Bopper\n"; fwrite($fh, $stringData); $stringData = "Tracy Tanner\n"; fwrite($fh, $stringData); fclose($fh); file shows up with: Bobby Bopper[]Tracy Tanner[] instead of: Bobby Bopper Tracy Tanner google searches return nothing related. can't imagine anybody having this problem. Going nuts, i've done this before dont' know what i'm doing different. Quote Link to comment https://forums.phpfreaks.com/topic/59296-line-breaks-written-to-file-do-not-show-up/ Share on other sites More sharing options...
mosi Posted July 10, 2007 Share Posted July 10, 2007 Try and replace \n with \r\n Quote Link to comment https://forums.phpfreaks.com/topic/59296-line-breaks-written-to-file-do-not-show-up/#findComment-294540 Share on other sites More sharing options...
wildteen88 Posted July 10, 2007 Share Posted July 10, 2007 I guess you are using notepad to view the file. Notepad only understands \r\n. When use \r or \n for new lines and display it in notepad all you'll get is square characters in placement of those chars. Change \n to \r\n and you'll see the new lines. Quote Link to comment https://forums.phpfreaks.com/topic/59296-line-breaks-written-to-file-do-not-show-up/#findComment-294552 Share on other sites More sharing options...
dlite922 Posted July 11, 2007 Author Share Posted July 11, 2007 thanks that did it! Quote Link to comment https://forums.phpfreaks.com/topic/59296-line-breaks-written-to-file-do-not-show-up/#findComment-295507 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.