My Web site is written in XHTML-Strict. I have made a basic guest book in PHP however I am having trouble checking the user's message for invalid characters. If the user enters a lot of weird characters, W3C Validator will complain that the page contains invalid SGML characters.
I am currently using htmlentities() but I need something else to either remove non-SGML characters or convert them to their appropriate entity. All of my pages use the iso-8859-1 charset. I tried using eregi() but failed miserably. I have searched Google for answers but I have not been able an appropriate piece of code that will do the trick.
Please help, thank you.
Resolved
if(eregi("^[[:alnum:][:punct:][:space:]]+$",$_POST["message"])) {
...
}