Re: Sanitize::html replacing newlines with literal \n
Thanks. Strange that your newlines were double backslashed. Your post put me on the right track. I am using pre tags in my markup and didn't want to have to go through all of my controllers looking for each instance of Sanitize::clean, so I now have this as line 236 in sanitize.php: $data = str_replace('\n', "\n", $data); mathew-2 wrote: > > > If you read my post further up from today. I already posted the source > code that resolves your problem. > > > > -- View this message in context: http://n2.nabble.com/Sanitize%3A%3Ahtml-replacing-newlines-with-literal-%5Cn-tp1608411p1615174.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sanitize::html replacing newlines with literal \n
If you read my post further up from today. I already posted the source code that resolves your problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sanitize::html replacing newlines with literal \n
My bad. You're right. I just realized that I while I thought commenting that line out in sanitize.php did the trick, it actually worked because I'd commented out the call to Sanitize::clean() in my controller. So it's not Sanitize::html() that's the problem. Looks like I am back to square one... How can I prevent newlines being converted to literal \n? mathew-2 wrote: > > > That function is not called from Sanitize::html() > > > > > -- View this message in context: http://n2.nabble.com/Sanitize%3A%3Ahtml-replacing-newlines-with-literal-%5Cn-tp1608411p1615054.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sanitize::html replacing newlines with literal \n
That function is not called from Sanitize::html() --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sanitize::html replacing newlines with literal \n
1.2 RC3 cake/libs/sanitize.php line 147 mathew-2 wrote: > > > What version of Cake are you using? > > > > -- View this message in context: http://n2.nabble.com/Sanitize%3A%3Ahtml-replacing-newlines-with-literal-%5Cn-tp1608411p1614961.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sanitize::html replacing newlines with literal \n
What version of Cake are you using? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sanitize::html replacing newlines with literal \n
@Matthew: Yes it does. I commented it out and it fixed the problem. -- View this message in context: http://n2.nabble.com/Sanitize%3A%3Ahtml-replacing-newlines-with-literal-%5Cn-tp1608411p1614924.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sanitize::html replacing newlines with literal \n
Sanitize::html does not call stripWhitespace(). Sanitize::html replaces special characters with html escaped characters, but I believe it leaves \n alone since the backslash does not need escaping in html. I am able to sanitize my data while retaining the new line character. The only problem I've had is that the SQL cleaner adds an extra backslash but otherwise it works fine for me. $this->data['Document']['comments'] = $this->cleaner->html( $this->data ['Document']['comments'], true ); $this->data = $this->cleaner->clean( $this->data ); $this->data['Document']['comments'] = str_replace("\\n","",$this- >data['Document']['comments']); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sanitize::html replacing newlines with literal \n
Looking at http://api.cakephp.org/sanitize_8php-source.html#l00103 it appears that stripWhitespace() is the offending function. I'd rather not modify the Cake core, so is there another way to change this function to suit my needs? -- View this message in context: http://n2.nabble.com/Sanitize%3A%3Ahtml-replacing-newlines-with-literal-%5Cn-tp1608411p1610985.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Sanitize::html replacing newlines with literal \n
When Sanitize::html runs on data, it is changing newlines to \n. When I look at my data in MySQL, it's literally filled with \n characters. This renders both PRE and nl2br() because they're looking for newlines, not the characters \n. How can I get Sanitize::html to leave the newlines alone instead of converting to \n? Thanks! -- View this message in context: http://n2.nabble.com/Sanitize%3A%3Ahtml-replacing-newlines-with-literal-%5Cn-tp1608411p1608411.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---