stevenreid Posted December 15, 2007 Share Posted December 15, 2007 I've a facility where a site owner submits text that is saved into a csv from a textarea. When it is read back from the csv I have the problem of any returns being read in as \r\n\r\n I tried a character str_replace and I've read up a bit on the problem but none of the solutions I've found have seemed to work for me. $thisStoryStory = $thisStory[2]; $thisStoryStoryB = str_replace(array("\r\n\r\n", "\r\n", "\r", "\n"), "<br />",$thisStoryStory); echo "<p>".$thisStoryStoryB."</p>"; was what I used and I thought should have worked fine but I still get audience up for a great time.\r\n\r\nClick the link below to Cheers. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 15, 2007 Share Posted December 15, 2007 Use nl2br on the string... PhREEEk Quote Link to comment Share on other sites More sharing options...
stevenreid Posted December 15, 2007 Author Share Posted December 15, 2007 yes I tried that to no avail echo "<p>".nl2br($thisStoryStory)."</p>"; didn't do anything Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 What are you trying to do? Remove all that str_replace stuff, and just use echo nl2br($thisStory[2]); Quote Link to comment Share on other sites More sharing options...
stevenreid Posted December 15, 2007 Author Share Posted December 15, 2007 again - new line to break echo nl2br($thisStory[2]); or echo nl2br($thisStoryStory); doesn't work at all Could the server's version of PHP have anything to do with it? what about the page encoding? I've tried UTF and ISO Quote Link to comment 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.