Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 33848)
+++ src/wp-includes/formatting.php	(working copy)
@@ -3274,11 +3274,13 @@
 
 	if ( '' == $url )
 		return $url;
+	$url = str_replace(' ', '%20', $url);
 	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
 	if ( 0 !== stripos( $url, 'mailto:' ) ) {
 		$strip = array('%0d', '%0a', '%0D', '%0A');
 		$url = _deep_replace($strip, $url);
 	}
+
 	$url = str_replace(';//', '://', $url);
 	/* If the URL doesn't appear to contain a scheme, we
 	 * presume it needs http:// appended (unless a relative
Index: tests/phpunit/tests/formatting/EscUrl.php
===================================================================
--- tests/phpunit/tests/formatting/EscUrl.php	(revision 33848)
+++ tests/phpunit/tests/formatting/EscUrl.php	(working copy)
@@ -5,7 +5,7 @@
  */
 class Tests_Formatting_EscUrl extends WP_UnitTestCase {
 	function test_spaces() {
-		$this->assertEquals('http://example.com/MrWordPress', esc_url('http://example.com/Mr WordPress'));
+		$this->assertEquals('http://example.com/Mr%20WordPress', esc_url('http://example.com/Mr WordPress'));
 		$this->assertEquals('http://example.com/Mr%20WordPress', esc_url('http://example.com/Mr%20WordPress'));
 	}
 
Index: tests/phpunit/tests/formatting/GetUrlInContent.php
===================================================================
--- tests/phpunit/tests/formatting/GetUrlInContent.php	(revision 33848)
+++ tests/phpunit/tests/formatting/GetUrlInContent.php	(working copy)
@@ -34,7 +34,7 @@
 			), // multiple links
 			array (
 				'ABC<div><a href="http://example.com/Mr%20WordPress 2">LINK</a> CONTENT </div>',
-				"http://example.com/Mr%20WordPress2"
+				"http://example.com/Mr%20WordPress%202"
 			), // escape link
 		);
 	}
