NYCPHP Meetup

NYPHP.org

[nycphp-talk] Converting the pesky MS Word quotes and other characters

csnyder chsnyder at gmail.com
Wed Oct 29 15:41:56 EDT 2008


On Wed, Oct 29, 2008 at 3:30 PM, Joseph Crawford <codebowl at gmail.com> wrote:
> Has anyone on here found a viable solution?  Everything seems to work on the
> www side of things but as soon as i use the data in an RSS feed it does not
> seem to like the MS Word characters.
>

That's for sure.

Here's what I use, there's probably a more elegant/readable way to do it.

// convert smart quotes and mdashes
$wordchars=array('—','"','"',''',''',"…");
$fixedchars=array('&mdash;','&quot;','&quot;',"'","'","&hellip;");
$output = str_replace( $wordchars, $fixedchars, $output );

- chris.


More information about the talk mailing list