On 15 Jun 2011, at 19:06, Wade Preston Shearer wrote:
> Pasting text from MS word into a text area produces crappy results. I don't
> do this so it's not a problem for me but amazingly many people do. I'm not
> alone in trying to address this problem—there are many discussions and
> solutions across the net—but none of them are working for me. It's driving me
> crazy. Any ideas?
>
> I want to replace the fancy characters and replace them with their ascii
> counterparts.
>
On one site I worked on where we accept copy and paste from documents I used
the following function with some decent success. It could definitely use
enhancing.
/**
* This is from shiflett.org 26dec2009
* ( http://shiflett.org/blog/2005/oct/convert-smart-quotes-with-php )
*/
function convert_smart_quotes($string)
{
$search = array(chr(145),
chr(146),
chr(147),
chr(148),
chr(151));
$replace = array("'",
"'",
'"',
'"',
'-');
return str_replace($search, $replace, $string);
} // end function convert_smart_quotes
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net