i am using the cakephp paranoid function but i want it to not strip new line character. I tried passing \n开发者_StackOverflow中文版 in allowed chars but it failed
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.
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"));
精彩评论