You are here: Re: [PHP] getting rid of bad characters « PHP « IT news, forums, messages
Re: [PHP] getting rid of bad characters

Posted by Chris Shiflett on 10/31/05 18:12

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/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация