diff --git a/src/wp-includes/feed.php b/src/wp-includes/feed.php
index 810abfee6fa2d..8a6d2560681f3 100644
--- a/src/wp-includes/feed.php
+++ b/src/wp-includes/feed.php
@@ -842,7 +842,7 @@ function fetch_feed( $url ) {
do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
$feed->init();
- $feed->set_output_encoding( get_option( 'blog_charset' ) );
+ $feed->set_output_encoding( get_bloginfo( 'charset' ) );
if ( $feed->error() ) {
return new WP_Error( 'simplepie-error', $feed->error() );
diff --git a/tests/phpunit/tests/feed/fetchFeed.php b/tests/phpunit/tests/feed/fetchFeed.php
new file mode 100644
index 0000000000000..5fd9026a4beb4
--- /dev/null
+++ b/tests/phpunit/tests/feed/fetchFeed.php
@@ -0,0 +1,51 @@
+get_items( 0, 1 ) as $item ) {
+ $content = $item->get_content();
+ }
+
+ $this->assertStringContainsString( 'Learn WordPress is a learning resource providing workshops, quizzes, courses, lesson plans, and discussion groups so that anyone, from beginners to advanced users, can learn to do more with WordPress.', $content );
+ }
+
+ public function mocked_rss_response() {
+ $single_value_headers = array(
+ 'Content-Type' => 'application/rss+xml; charset=UTF-8',
+ 'link' => '; rel="https://api.w.org/"',
+ );
+
+ return array(
+ 'headers' => new WpOrg\Requests\Utility\CaseInsensitiveDictionary( $single_value_headers ),
+ 'body' => file_get_contents( DIR_TESTDATA . '/feed/wordpress-org-news.xml' ),
+ 'response' => array(
+ 'code' => 200,
+ 'message' => 'OK',
+ ),
+ 'cookies' => array(),
+ 'filename' => null,
+ );
+ }
+}