Re: Unwanted Characters
| From: | CC Zona | Date: | Sun, 25 Feb 2001 07:33:27 +0000 |
| Subject: | Re: Unwanted Characters | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41555@lists.php.net to get a copy of this message | ||
In article <20010224220539.C23830@zebulon.miester.org>,
jstump@zebulon.miester.org (Joe Stump) wrote:
> Look at the chr() function - figure out what the character is (number wise)
> and
> then do an ereg_replace(chr(),'',$string) (from the hip - you can do a
> replace
> with chr() on one of the replaces, I've done it before)
>
> --Joe
>
> On Sun, Feb 25, 2001 at 12:34:21AM -0500, 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"
And you might also want to look at strtr()
<http://php.net/manual/en/function.strtr.php>.
You could, I suppose, use
it to substitute some character that you know would never legitimately
appear in $sometext, then do a straight str_replace() on the string for all
occurences of that character.
--
CC