Text escaping / unescaping help - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Text escaping / unescaping help (/showthread.php?tid=8870) |
Text escaping / unescaping help - El Forum - 06-03-2008 [eluser]Sceneshift[/eluser] I hate myself for asking this question, but I can't seem to find a solution. I have a text area, I am adding the contents to a database using active record. It's escaping all the apostrophes and adding \n's for line breaks, which is fine. I am happy with that. How do I then take that data out of the database and display it in a nice manner? I tried using the typography helper, but it obviously doesn't work in conjunction with stripslashes which I need because of the escaped apostrophes. Sorry for the stupid question! Text escaping / unescaping help - El Forum - 06-03-2008 [eluser]stuffradio[/eluser] In the main method call the method string helper: Code: $this->load->helper('string'); When pulling the data go: Code: $this->strip_slashes($text); Text escaping / unescaping help - El Forum - 06-04-2008 [eluser]Sceneshift[/eluser] Thanks a lot... I am still getting \n's turning into just"n"'s now, any it seems I can even have one or the other. Text escaping / unescaping help - El Forum - 06-04-2008 [eluser]xwero[/eluser] the php way to display multiline texts is Code: nl2br(htmlentities($text)); Text escaping / unescaping help - El Forum - 06-04-2008 [eluser]stuffradio[/eluser] Oh yes, xwero that is the best way to do it. I misread his thread. I too use that function to do this Text escaping / unescaping help - El Forum - 06-04-2008 [eluser]Sceneshift[/eluser] Raaaaar this is driving me mad Entry looks like this in my database: "line1\n\nline2" it's mysql_real_escape_string'd. Then using <?=nl2br(htmlentities($text))?> I get: "line1\n\nline2" What am I doing wrong? Sorry guys. |