Index: wp-includes/general-template.php
===================================================================
--- wp-includes/general-template.php	(revision 4144)
+++ wp-includes/general-template.php	(working copy)
@@ -799,4 +799,9 @@
 	<?php
 }
 
+function wp_search_query() {
+	global $s;
+	echo wp_specialchars( stripslashes($s), 1 );
+}
+
 ?>
Index: wp-content/themes/default/searchform.php
===================================================================
--- wp-content/themes/default/searchform.php	(revision 4144)
+++ wp-content/themes/default/searchform.php	(working copy)
@@ -1,5 +1,5 @@
 <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
-<div><input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
+<div><input type="text" value="<?php wp_search_query(); ?>" name="s" id="s" />
 <input type="submit" id="searchsubmit" value="Search" />
 </div>
 </form>
Index: wp-content/themes/default/sidebar.php
===================================================================
--- wp-content/themes/default/sidebar.php	(revision 4144)
+++ wp-content/themes/default/sidebar.php	(working copy)
@@ -30,7 +30,7 @@
 
 		 <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
 			<p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
-			for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
+			for <strong>'<?php wp_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
 
 			<?php /* If this is a monthly archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
 			<p>You are currently browsing the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives.</p>

