Index: wp-includes/default-filters.php
===================================================================
--- wp-includes/default-filters.php	(revision 6181)
+++ wp-includes/default-filters.php	(working copy)
@@ -25,12 +25,21 @@
 	add_filter($filter, 'wp_filter_kses');
 }
 
-// URL
+// Save URL
 $filters = array('pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
-	'pre_link_rss', 'comment_url');
+	'pre_link_rss');
 foreach ( $filters as $filter ) {
 	add_filter($filter, 'strip_tags');
 	add_filter($filter, 'trim');
+	add_filter($filter, 'sanitize_url');
+	add_filter($filter, 'wp_filter_kses');
+}
+
+// Display URL
+$filters = array('user_url', 'link_url', 'link_image', 'link_rss', 'comment_url');
+foreach ( $filters as $filter ) {
+	add_filter($filter, 'strip_tags');
+	add_filter($filter, 'trim');
 	add_filter($filter, 'clean_url');
 	add_filter($filter, 'wp_filter_kses');
 }
Index: wp-includes/formatting.php
===================================================================
--- wp-includes/formatting.php	(revision 6181)
+++ wp-includes/formatting.php	(working copy)
@@ -1087,7 +1087,7 @@
 	return apply_filters('richedit_pre', $output);
 }
 
-function clean_url( $url, $protocols = null ) {
+function clean_url( $url, $protocols = null, $context = 'display' ) {
 	$original_url = $url;
 
 	if ('' == $url) return $url;
@@ -1103,15 +1103,22 @@
 		substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
 		$url = 'http://' . $url;
 
-	$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url);
+	// Replace ampersands ony when displaying.
+	if ( 'display' == $context )
+		$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url);
+
 	if ( !is_array($protocols) )
 		$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
 	if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
 		return '';
 
-	return apply_filters('clean_url', $url, $original_url);
+	return apply_filters('clean_url', $url, $original_url, $context);
 }
 
+function sanitize_url( $url, $protocols = null ) {
+	return clean_url( $url, $protocols, 'db');
+}
+
 // Borrowed from the PHP Manual user notes. Convert entities, while
 // preserving already-encoded entities:
 function htmlentities2($myHTML) {
Index: wp-includes/widgets.php
===================================================================
--- wp-includes/widgets.php	(revision 6181)
+++ wp-includes/widgets.php	(working copy)
@@ -1001,7 +1001,7 @@
 	$options = $newoptions = get_option('widget_rss');
 	if ( $_POST["rss-submit-$number"] ) {
 		$newoptions[$number]['items'] = (int) $_POST["rss-items-$number"];
-		$url = clean_url(strip_tags(stripslashes($_POST["rss-url-$number"])));
+		$url = sanitize_url(strip_tags(stripslashes($_POST["rss-url-$number"])));
 		$newoptions[$number]['title'] = trim(strip_tags(stripslashes($_POST["rss-title-$number"])));
 		if ( $url !== $options[$number]['url'] ) {
 			require_once(ABSPATH . WPINC . '/rss.php');
