NYCPHP Meetup

NYPHP.org

[nycphp-talk] stupid curly quotes

Daniel Convissor danielc at analysisandsolutions.com
Wed Mar 16 19:06:03 EST 2005


On Wed, Mar 16, 2005 at 04:46:17PM -0500, Marc Antony Vose wrote:
> 
> How do people here handle stripping crap like curly quotes out of 
> text that users are pasting from Microsoft Word?

    $search = array(
        '/[\x07\x95]/',
        '/\x85/',
        '/[\x91\x92]/',
        '/[\x93\x94]/',
    );
    $replace = array(
        '-',
        '...',
        '\'',
        '"',
    );
    $data = preg_replace($search, $replace, $data);

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list