anotherJEK
04-14-2012, 03:26 AM
Is this the best way to represent new line/(carriage return) and tab characters?
$_txtScreen = '+=()*&^%$#@!~\`"\'/<>|{}[]'."\n"."\r"."\t"."\n\r";
I want to screen for new lines and tabs in $_POST vars input.
I expect that they would only occur in input from textArea fields, normally.
Then escaping them properly is my problem. I assume they would be url encoded by the browser and url unencoded by php.
So testing I am using === to test equality and escaping
with '\'.(new line or tab char).'\'; as
if($_char === "\n")
{
$_char = "'\'".$char; // I want a literal representation here: \n, ideally
}
Alternative is to convert from functional representation to literal representation, but I am not sure how to do that. Or, maybe I don't
need to if is already rendered literal by php in the process of url unencode.
Thanks for time and attention.
$_txtScreen = '+=()*&^%$#@!~\`"\'/<>|{}[]'."\n"."\r"."\t"."\n\r";
I want to screen for new lines and tabs in $_POST vars input.
I expect that they would only occur in input from textArea fields, normally.
Then escaping them properly is my problem. I assume they would be url encoded by the browser and url unencoded by php.
So testing I am using === to test equality and escaping
with '\'.(new line or tab char).'\'; as
if($_char === "\n")
{
$_char = "'\'".$char; // I want a literal representation here: \n, ideally
}
Alternative is to convert from functional representation to literal representation, but I am not sure how to do that. Or, maybe I don't
need to if is already rendered literal by php in the process of url unencode.
Thanks for time and attention.