This doesn't seem to work, have I done something wrong?



$sometext = "ThÀe cØar röøan over mÖy dog\n";
   $thread =  ereg_replace("[^[:alnum:][:space:]]", "", $sometext);
   echo $thread;

still prints:
ThÀe cØar röøan over mÖy dog


Thanks,
Clayton


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Clayton Dukes" <[EMAIL PROTECTED]>
Sent: Sunday, February 25, 2001 2:28 AM
Subject: Re: [PHP] Unwanted Characters


> Clayton Dukes wrote:
> >
> > How do I remove unwanted/unprintable characters from a variable?
> >
> > $sometext = "ThÀe cØar röøan over mÖy dog"
> > needs to be filtered and reprinted as:
> > "The car ran over my dog"
> >
> > Thanks :-)
> > Clayton Dukes
>
> <?php
> $sometext = "ThÀe cØar röøan over mÖy dog";
> $thread =  ereg_replace("[^[:alnum:][:space:]]", "", $sometext);
> echo $thread
> ?>
>
> will print what you asked - of course you may not want numbers but you
> get the idea.
> I do this check on all my user inputs to php scripts- I choose what is
> allowed not what to deny which makes it easier.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to