Try using the php function [addslashes][1]:

    <?php
    $str = "Is your name O'reilly?";
    
    // Outputs: Is your name O\'reilly?
    echo addslashes($str);
    ?>

So for EE you could have something like:

   

    <p>This is the title and excerpt of this entry: "
    	<?php 
    		$str = "<strong>". addslashes({title}) . "</strong> : ";
    		$str .= addslashes({post_excerpt}); // combine title and post_excerpt
    		echo  stripslashes($str); // remove the slashes.
    	?>
    "</p>

  [1]: http://php.net/manual/en/function.addslashes.php