Index: tests/formatting/WPTexturize.php
===================================================================
--- tests/formatting/WPTexturize.php	(revision 1337)
+++ tests/formatting/WPTexturize.php	(working copy)
@@ -194,4 +194,29 @@
 		$this->assertEquals( ' &#8212;&nbsp;', wptexturize( ' --&nbsp;' ) );
 		$this->assertEquals( '&nbsp;&#8212; ', wptexturize( '&nbsp;-- ') );
 	}
+
+	/**
+	 * @ticket 22692
+	 */
+	function test_spaces_around_quotes() {
+		$nbsp = "\xC2\xA0";
+
+		// This should never happen, even if the desired output changes some day.
+
+		$problem_input = "$nbsp\"A";
+		$problem_output = "$nbsp&#8221;A";
+
+		$this->assertNotEquals( $problem_output, wptexturize( $problem_input ) );
+
+		// These are desirable outputs for the current design.
+
+		$input1 = "A sentence. $nbsp\"A quote after 2 spaces.\"";
+		$input2 = "A sentence.$nbsp$nbsp\"A quote after 2 spaces.\"";
+
+		$output1 = "A sentence. $nbsp&#8220;A quote after 2 spaces.&#8221;";
+		$output2 = "A sentence.$nbsp$nbsp&#8220;A quote after 2 spaces.&#8221;";
+
+		$this->assertEquals( $output1, wptexturize( $input1 ) );
+		$this->assertEquals( $output2, wptexturize( $input2 ) );
+	}
 }
