tags:

views:

48

answers:

2

Hi ,

i am using the cakephp paranoid function but i want it to not strip new line character. I tried passing \n in allowed chars but it failed

+1  A: 

What syntax are you using? Make sure that $allowedChars is an array and that you used double-quotes for the newline (single-quotes do not parse escapes like newline):

Sanitize::paranoid($badString, array("\n"));
Delan Azabani
+4  A: 

You have to make sure you using the correct quotes:

echo Sanitize::paranoid($badString,array("\r\n","\n"));

Always use double quotes if your sending in escape chars, and if your stripping both returns and newlines make sure that "\r\n" comes before, as im sure the function will sanitize int he order of chars passed in.

RobertPitt