RE: RE: Re: high-bit characters

From: Date: Sat, 09 Jun 2007 16:29:31 +0000
Subject: RE: RE: Re: high-bit characters
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-256444@lists.php.net to get a copy of this message
WeberSites LTD dedi ki: > Thanks, I'll have a look at it. > > I do want to allow some chars so I'm trying to replace them > like this : > > $post_text=str_replace(chr(146),"'",$post_text); > > or > > $post_text=str_replace("’","'",$post_text); > > > However, it seems that str_replace does not actually replace > the chars cause they still end up in the output. > > any idea? It works for me: echo str_replace(chr(146),"'",str_repeat("X".chr(146)."Y", 10)); X'YX'YX'YX'YX'YX'YX'YX'YX'YX'Y Also: (should be lighter and faster than str_replace, I think) echo strtr(str_repeat("X".chr(146)."Y", 10), chr(146), "'"); X'YX'YX'YX'YX'YX'YX'YX'YX'YX'Y It might be related to your input - perhaps not 8-bit clean? Perhaps preprocessed in some way through the pipe (network, linux, apache, php.ini settings, etc.) before it reached your script? Hard to guess. I would've written (in binary safe way) the input to a temp file and then inspected it via hexdump, less, hexedit etc. Kind regards, -- Abdullah Ramazanoglu aramazan ÄT myrealbox D0T cöm

« previous php.general (#256444) next »