Index: wp-testcase/test_includes_formatting.php
===================================================================
--- wp-testcase/test_includes_formatting.php	(revision 320)
+++ wp-testcase/test_includes_formatting.php	(working copy)
@@ -463,7 +463,23 @@
 		$this->assertEquals('&#8216;<strong>Quoted Text</strong>&#8217;,', wptexturize("'<strong>Quoted Text</strong>',"));
 		$this->assertEquals('&#8220;<strong>Quoted Text</strong>&#8221;,', wptexturize('"<strong>Quoted Text</strong>",'));
 	}
-	
+
+	//WP Ticket #15241
+	function test_many_single_quotes() {
+		$this->assertEquals('This isn&#8217;t inherently bad, but I don&#8217;t think it&#8217;s normal.', wptexturize("This isn't inherently bad, but I don't think it's normal."));
+	}
+
+	//WP Ticket #1258
+	function test_enumeration() {
+		$this->assertEquals("&#8216;products&#8217;, &#8216;services&#8217;", wptexturize("'products', 'services'"));
+		$this->assertEquals("&#8216;hello&#8217;, &#8216;world&#8217;, &#8217;tis ", wptexturize("'hello', 'world', 'tis "));
+	}
+
+	//WP Ticket #11275
+	function test_quoting() {
+		$this->assertEquals('She said—&#8220;No!&#8221;', wptexturize('She said—"No!"'));
+	}
+
 	function test_x() {
 		$this->assertEquals('14&#215;24', wptexturize("14x24"));
 	}
Index: wordpress/wp-includes/formatting.php
===================================================================
--- wordpress/wp-includes/formatting.php	(revision 16476)
+++ wordpress/wp-includes/formatting.php	(working copy)
@@ -56,9 +56,23 @@
 		$static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn&#8211;', '...', '``', '\'\'', ' (tm)'), $cockney);
 		$static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', ' &#8211; ', 'xn--', '&#8230;', $opening_quote, $closing_quote, ' &#8482;'), $cockneyreplace);
 
-		$dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/\'(\d)/', '/(\s|\A|[([{<]|")\'/', '/(\d)"/', '/(\d)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/\b(\d+)x(\d+)\b/');
-		$dynamic_replacements = array('&#8217;$1','&#8217;$1', '$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '&#8217;$1', '$1&#215;$2');
+		$dynamic_map = array(
+			'/\'(\d)/' => '&#8217;$1', // '99
 
+			'/(\w)\'(\w)/' => '$1&#8217;$2', // test's
+
+			'/\'([^\']*)\'/' => '&#8216;$1&#8217;', // 'asd'
+			'/"([^"]*)"/' => $opening_quote . '$1' . $closing_quote, // "qwe"
+
+			'/(\d)\'/' => '$1&#8242;', // 9'
+			'/(\d)"/' => '$1&#8243;', // 9"
+
+			'/\b(\d+)x(\d+)\b/' => '$1&#215;$2' // 97x34
+		);
+
+		$dynamic_characters = array_keys($dynamic_map);
+		$dynamic_replacements = array_values($dynamic_map);
+
 		$static_setup = true;
 	}
 
@@ -70,6 +84,9 @@
 	$no_texturize_tags_stack = array();
 	$no_texturize_shortcodes_stack = array();
 
+	$single_quote_state = '&#8216;';
+	$double_quote_state = $opening_quote;
+
 	for ( $i = 0; $i < $stop; $i++ ) {
 		$curl = $textarr[$i];
 
@@ -80,6 +97,15 @@
 			$curl = str_replace($static_characters, $static_replacements, $curl);
 			// regular expressions
 			$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
+			// quotes that span multiple tags & shortcodes
+			while (($pos = strpos($curl, '\'')) !== FALSE) {
+				$curl = preg_replace('/\'/', $single_quote_state, $curl);
+				$single_quote_state = (($single_quote_state == '&#8216;') ? '&#8217;' : '&#8216;');
+			}
+			while (($pos = strpos($curl, '"')) !== FALSE) {
+				$curl = preg_replace('/"/', $double_quote_state, $curl);
+				$double_quote_state = (($double_quote_state == $opening_quote) ? $closing_quote : $opening_quote);
+			}
 		} elseif (!empty($curl)) {
 			/*
 			 * Only call _wptexturize_pushpop_element if first char is correct
