Re: getting rid of bad characters

From: Date: Mon, 31 Oct 2005 16:12:37 +0000
Subject: Re: getting rid of bad characters
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-224884@lists.php.net to get a copy of this message
Dan McCullough wrote:
I having been looking for some snippet to help me with changing MS Word double, quotes, single quotes and other characters to acceptable HTML safe characters.
This seems to work: $search = array('/[\x07\x95]/',
                '/\x85/',
                '/[\x91\x92]/',
                '/[\x93\x94]/');
$replace = array('-',
                 '...',
                 "'",
                 '"');
$string = preg_replace($search, $replace, $string); Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/

« previous php.general (#224884) next »