diff --git a/src/wp-includes/feed.php b/src/wp-includes/feed.php
index 453cc9063cf75..b256ab3bcc348 100644
--- a/src/wp-includes/feed.php
+++ b/src/wp-includes/feed.php
@@ -406,13 +406,23 @@ function get_the_category_rss( $type = null ) {
$cat_names = array_unique( $cat_names );
+ $blog_charset = '';
+ $atom_scheme = '';
+ if ( $cat_names ) {
+ if ( 'atom' === $type ) {
+ $atom_scheme = get_bloginfo_rss( 'url' );
+ } elseif ( 'rdf' !== $type ) {
+ $blog_charset = get_option( 'blog_charset' );
+ }
+ }
+
foreach ( $cat_names as $cat_name ) {
if ( 'rdf' === $type ) {
$the_list .= "\t\t\n";
} elseif ( 'atom' === $type ) {
- $the_list .= sprintf( '', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) );
+ $the_list .= sprintf( '', esc_attr( $atom_scheme ), esc_attr( $cat_name ) );
} else {
- $the_list .= "\t\t\n";
+ $the_list .= "\t\t\n";
}
}