src/ICal/ICal.php
protected function cleanData($data)
    {
        $replacementChars = array(
            "\xe2\x80\x98" => "'",   // ‘
            "\xe2\x80\x99" => "'",   // ’
            "\xe2\x80\x9a" => "'",   // ‚
            "\xe2\x80\x9b" => "'",   // ‛
            "\xe2\x80\x9c" => '"',   // “
            "\xe2\x80\x9d" => '"',   // ”
            "\xe2\x80\x9e" => '"',   // „
            "\xe2\x80\x9f" => '"',   // ‟
            "\xe2\x80\x93" => '-',   // –
            "\xe2\x80\x94" => '--',  // —
            "\xe2\x80\xa6" => '...', // …
            "\xc2\xa0"     => ' ',
        );
        // Replace UTF-8 characters
        $cleanedData = strtr($data, $replacementChars);

        // Replace Windows-1252 equivalents
        $charsToReplace = array_map(function ($code) {
            return $this->mb_chr($code);
        }, array(133, 145, 146, 147, 148, 150, 151, 194));
        $cleanedData = $this->mb_str_replace($charsToReplace, $replacementChars, $cleanedData);

        return $cleanedData;
    }
protected function cleanData($data)
    {
        $replacementChars = array(
            "\xe2\x80\x98" => "'",   // ‘
            "\xe2\x80\x99" => "'",   // ’
            "\xe2\x80\x9a" => "'",   // ‚
            "\xe2\x80\x9b" => "'",   // ‛
            "\xe2\x80\x9c" => '"',   // “
            "\xe2\x80\x9d" => '"',   // ”
            "\xe2\x80\x9e" => '"',   // „
            "\xe2\x80\x9f" => '"',   // ‟
            "\xe2\x80\x93" => '-',   // –
            "\xe2\x80\x94" => '--',  // —
            "\xe2\x80\xa6" => '...', // …
            "\xc2\xa0"     => ' ',
        );
        // Replace UTF-8 characters
        $cleanedData = strtr($data, $replacementChars);

        // Replace Windows-1252 equivalents
        $charsToReplace = array_map(function ($code) {
            return $this->mb_chr($code);
        }, array(133, 145, 146, 147, 148, 150, 151, 194));
        $cleanedData = $this->mb_str_replace($charsToReplace, $replacementChars, $cleanedData);

        return $cleanedData;
    }
protected function cleanData ( $ data ) { $ replacementChars = array ( "\xe2\x80\x98" => "'" , // ‘ "\xe2\x80\x99" => "'" , // ’ "\xe2\x80\x9a" => "'" , // ‚ "\xe2\x80\x9b" => "'" , // ‛ "\xe2\x80\x9c" => '"' , // “ "\xe2\x80\x9d" => '"' , // ” "\xe2\x80\x9e" => '"' , // „ "\xe2\x80\x9f" => '"' , // ‟ "\xe2\x80\x93" => '-' , // – "\xe2\x80\x94" => '--' , // — "\xe2\x80\xa6" => '...' , // … "\xc2\xa0" => ' ' , ) ; // Replace UTF-8 characters $ cleanedData = strtr ( $ data , $ replacementChars ) ; // Replace Windows-1252 equivalents $ charsToReplace = array_map ( function ( $ code ) { return $ this -> mb_chr ( $ code ) ; } , array ( 133 , 145 , 146 , 147 , 148 , 150 , 151 , 194 ) ) ; $ cleanedData = $ this -> mb_str_replace ( $ charsToReplace , $ replacementChars , $ cleanedData ) ; return $ cleanedData ; }
Replaces curly quotes and other special characters
with their standard equivalents

@param  string $data
@return string
Replaces curly quotes and other special characters with their standard equivalents