Re: Filter out MS Word 'quotes' for RSS

From: Date: Wed, 26 Apr 2006 11:30:31 +0000
Subject: Re: Filter out MS Word 'quotes' for RSS
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-234795@lists.php.net to get a copy of this message
On 4/26/06, Kevin Davies <kevin.davies@bonhurst.com> wrote: > Hi All, > > I've got a forum/blog system which is displaying correctly in the browser.. > However, I've also got an RSS feed that is created from the data entered. > > It seems that some of the users are copying and pasting from MS Word or > other packages, and this means that strange quote marks (among others) are > appearing, and breaking the RSS feed. > > Obviously I need to convert these on entry, or on output into RSS. Does > anyone know of an easy way to do this, or is it a case of identifying each > unusual character individually? I don't think there's anything to do this for you. If it's only quotes you could do it quite simply. str_replace lets you use arrays for both search and/or replace parameters, so: $bad_chars = array(...); $good_chars = "'"; $text = str_replace($bad_chars, $good_chars, $text); -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#234795) next »