Question

I used Sanitize::clean in cakePHP to sanitize user input and in result I got "\r" character.

  1. What does this character mean ("\r") ?
  2. Is there a function that does the reverse of Sanitize::clean, so I can use before outputting the data.
Was it helpful?

Solution

You can get rid of this character (and others) by calling trim($userInput); or this way using Sanitize::clean :

$opts = array('carriage'=>true);
$cleaned = Sanitize::clean($userInput,$opts);

OTHER TIPS

"\r" is the Carriage Return character (when printing to the console, it causes output to start on the next line but does not affect display of web pages).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top