My Bad, str_replace works well and so does my original solution with the for loop. This way I get to replace special chars that I want with similar chars between 32 and 126 and not show posts that have other chars. Thanks for your help berber -----Original Message----- From: news [mailto:news@xxxxxxxxxxxxx] On Behalf Of Abdullah Ramazanoglu Sent: Saturday, June 09, 2007 6:30 PM To: php-general@xxxxxxxxxxxxx Subject: RE: RE: Re: high-bit characters 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php