Index: src/wp-includes/canonical.php
===================================================================
--- src/wp-includes/canonical.php	(revision 39107)
+++ src/wp-includes/canonical.php	(working copy)
@@ -391,8 +391,8 @@
 	// trailing /index.php
 	$redirect['path'] = preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path']);
 
-	// Remove trailing spaces from the path
-	$redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] );
+	// Remove trailing spaces and end punctuation from the path.
+	$redirect['path'] = preg_replace( '#([^0-9a-zA-Z/]|%22|%7B|\)|%27|%E2%80%9C|%E2%80%9D|%20| )+$#', '', $redirect['path'] );
 
 	if ( !empty( $redirect['query'] ) ) {
 		// Remove trailing spaces from certain terminating query string args
Index: tests/phpunit/tests/canonical/noRewrite.php
===================================================================
--- tests/phpunit/tests/canonical/noRewrite.php	(revision 39107)
+++ tests/phpunit/tests/canonical/noRewrite.php	(working copy)
@@ -55,6 +55,11 @@
 			array( '/?feed=rss2&p=1', '/?feed=rss2&p=1', 21841 ),
 			array( '/?feed=rss&p=1', '/?feed=rss2&p=1', 24623 ),
 
+			// Trailing spaces and punctuation.
+			array( '/page/2/ ', '/page/2/' ),
+			array( '/page/2/%22', '/page/2/' ),
+			array( '/page/2/%27', '/page/2/' ),
+			array( '/page/2/%E2%80%9C', '/page/2/' ),
 		);
 	}
 }
