Index: wp-includes/formatting.php
===================================================================
--- wp-includes/formatting.php	(revision 13532)
+++ wp-includes/formatting.php	(working copy)
@@ -761,11 +761,15 @@
  *
  * @param string $title The string to be sanitized.
  * @param string $fallback_title Optional. A title to use if $title is empty.
+ * @param string $context Optional. The context for which the string is sanitized
  * @return string The sanitized string.
  */
-function sanitize_title($title, $fallback_title = '') {
+function sanitize_title($title, $fallback_title = '', $remove_accents = true) {
 	$raw_title = $title;
-	$title = strip_tags($title);
+
+	if ( $remove_accents )
+		$title = remove_accents($title);
+
 	$title = apply_filters('sanitize_title', $title, $raw_title);
 
 	if ( '' === $title || false === $title )
@@ -774,6 +778,10 @@
 	return $title;
 }
 
+function sanitize_title_for_query($title) {
+	return sanitize_title($title, '', false);
+}
+
 /**
  * Sanitizes title, replacing whitespace with dashes.
  *
@@ -794,7 +802,6 @@
 	// Restore octets.
 	$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
 
-	$title = remove_accents($title);
 	if (seems_utf8($title)) {
 		if (function_exists('mb_strtolower')) {
 			$title = mb_strtolower($title, 'UTF-8');
Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 13532)
+++ wp-includes/query.php	(working copy)
@@ -1402,14 +1402,14 @@
 			if ( !is_array($qv['tag_slug__in']) || empty($qv['tag_slug__in']) ) {
 				$qv['tag_slug__in'] = array();
 			} else {
-				$qv['tag_slug__in'] = array_map('sanitize_title', $qv['tag_slug__in']);
+				$qv['tag_slug__in'] = array_map('sanitize_title_for_query', $qv['tag_slug__in']);
 				$this->is_tag = true;
 			}
 
 			if ( !is_array($qv['tag_slug__and']) || empty($qv['tag_slug__and']) ) {
 				$qv['tag_slug__and'] = array();
 			} else {
-				$qv['tag_slug__and'] = array_map('sanitize_title', $qv['tag_slug__and']);
+				$qv['tag_slug__and'] = array_map('sanitize_title_for_query', $qv['tag_slug__and']);
 				$this->is_tag = true;
 			}
 
@@ -1707,7 +1707,7 @@
 			$where .= " AND DAYOFMONTH($wpdb->posts.post_date)='" . $q['day'] . "'";
 
 		if ('' != $q['name']) {
-			$q['name'] = sanitize_title($q['name']);
+			$q['name'] = sanitize_title_for_query($q['name']);
 			$where .= " AND $wpdb->posts.post_name = '" . $q['name'] . "'";
 		} else if ('' != $q['pagename']) {
 			if ( isset($this->queried_object_id) )
@@ -1724,7 +1724,7 @@
 			if  ( ('page' != get_option('show_on_front') ) ||  empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) {
 				$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
 				$page_paths = '/' . trim($q['pagename'], '/');
-				$q['pagename'] = sanitize_title(basename($page_paths));
+				$q['pagename'] = sanitize_title_for_query(basename($page_paths));
 				$q['name'] = $q['pagename'];
 				$where .= " AND ($wpdb->posts.ID = '$reqpage')";
 				$reqpage_obj = get_page($reqpage);
@@ -1737,7 +1737,7 @@
 		} elseif ('' != $q['attachment']) {
 			$q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
 			$attach_paths = '/' . trim($q['attachment'], '/');
-			$q['attachment'] = sanitize_title(basename($attach_paths));
+			$q['attachment'] = sanitize_title_for_query(basename($attach_paths));
 			$q['name'] = $q['attachment'];
 			$where .= " AND $wpdb->posts.post_name = '" . $q['attachment'] . "'";
 		}
@@ -1844,18 +1844,18 @@
 
 		// Category stuff for nice URLs
 		if ( '' != $q['category_name'] && !$this->is_singular ) {
-			$q['category_name'] = implode('/', array_map('sanitize_title', explode('/', $q['category_name'])));
+			$q['category_name'] = implode('/', array_map('sanitize_title_for_query', explode('/', $q['category_name'])));
 			$reqcat = get_category_by_path($q['category_name']);
 			$q['category_name'] = str_replace('%2F', '/', urlencode(urldecode($q['category_name'])));
 			$cat_paths = '/' . trim($q['category_name'], '/');
-			$q['category_name'] = sanitize_title(basename($cat_paths));
+			$q['category_name'] = sanitize_title_for_query(basename($cat_paths));
 
 			$cat_paths = '/' . trim(urldecode($q['category_name']), '/');
-			$q['category_name'] = sanitize_title(basename($cat_paths));
+			$q['category_name'] = sanitize_title_for_query(basename($cat_paths));
 			$cat_paths = explode('/', $cat_paths);
 			$cat_path = '';
 			foreach ( (array) $cat_paths as $pathdir )
-				$cat_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir);
+				$cat_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title_for_query($pathdir);
 
 			//if we don't match the entire hierarchy fallback on just matching the nicename
 			if ( empty($reqcat) )
@@ -2027,7 +2027,7 @@
 					$q['author_name'] = $q['author_name'][count($q['author_name'])-2];#there was a trailling slash
 				}
 			}
-			$q['author_name'] = sanitize_title($q['author_name']);
+			$q['author_name'] = sanitize_title_for_query($q['author_name']);
 			$q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
 			$q['author'] = get_user_by('slug', $q['author_name']);
 			if ( $q['author'] )
