Index: wp-includes/feed.php
===================================================================
--- wp-includes/feed.php	(revision 10336)
+++ wp-includes/feed.php	(working copy)
@@ -315,29 +315,34 @@
 	$categories = get_the_category();
 	$tags = get_the_tags();
 	$the_list = '';
-	$cat_names = array();
+	$cats = array();
 
 	$filter = 'rss';
 	if ( 'atom' == $type )
 		$filter = 'raw';
 
 	if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
-		$cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
+		$cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
+		$cats[$cat_name] = $category;
 	}
 
 	if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
-		$cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
+		$cat_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
+		$cats[$cat_name] = $tag;
 	}
 
-	$cat_names = array_unique($cat_names);
-
-	foreach ( $cat_names as $cat_name ) {
+	foreach ( $cats as $cat_name => $category ) {
 		if ( 'rdf' == $type )
 			$the_list .= "\n\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
-		elseif ( 'atom' == $type )
-			$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $cat_name ) );
-		else
-			$the_list .= "\n\t\t<category><![CDATA[" . html_entity_decode( $cat_name ) . "]]></category>\n";
+		elseif ( 'atom' == $type ) {
+			$blog_url = apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) );
+			$scheme = attribute_escape( $category->taxonomy =='post_tag' ? $blog_url . "/tag/" : $blog_url . "/category/" );
+			$label = attribute_escape( $cat_name );
+			$the_list .= "\n\t\t<category scheme=\"$scheme\" term=\"{$category->slug}\" label=\"$label\"/>\n";
+		} else {
+			$domain = $category->taxonomy =='post_tag' ? "tag" : "category";
+			$the_list .= "\n\t\t<category domain=\"$domain\"><![CDATA[" . html_entity_decode( $cat_name ) . "]]></category>\n";
+		}
 	}
 
 	return apply_filters('the_category_rss', $the_list, $type);
