Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 6702)
+++ wp-includes/query.php	(working copy)
@@ -833,6 +833,7 @@
 			$where .= " AND DAYOFMONTH(post_date)='" . $q['day'] . "'";
 
 		if ('' != $q['name']) {
+			$q['name'] = urlencode($q['name']);
 			$q['name'] = sanitize_title($q['name']);
 			$where .= " AND post_name = '" . $q['name'] . "'";
 		} else if ('' != $q['pagename']) {
Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 6702)
+++ wp-includes/link-template.php	(working copy)
@@ -97,11 +97,11 @@
 			$date[3],
 			$date[4],
 			$date[5],
-			$post->post_name,
+			urlencode($post->post_name),
 			$post->ID,
 			$category,
 			$author,
-			$post->post_name,
+			urlencode($post->post_name),
 		);
 		$permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink);
 		$permalink = user_trailingslashit($permalink, 'single');
Index: wp-includes/formatting.php
===================================================================
--- wp-includes/formatting.php	(revision 6702)
+++ wp-includes/formatting.php	(working copy)
@@ -341,12 +341,6 @@
 
 function sanitize_title_with_dashes($title) {
 	$title = strip_tags($title);
-	// Preserve escaped octets.
-	$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
-	// Remove percent signs that are not part of an octet.
-	$title = str_replace('%', '', $title);
-	// Restore octets.
-	$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
 
 	$title = remove_accents($title);
 	if (seems_utf8($title)) {
