diff --git a/core/includes/unicode.inc b/core/includes/unicode.inc
index f0df33ede2cb0d076def46723092fc733c27ee26..b09ddb765fefd78a93e3b946ba45cf9b2446dbed 100644
--- a/core/includes/unicode.inc
+++ b/core/includes/unicode.inc
@@ -74,6 +74,11 @@ function unicode_requirements() {
  *   An XML parser object or FALSE on error.
  *
  * @ingroup php_wrappers
+ *
+ * @deprecated in Drupal 8.3.0 and will bre removed in Drupal 9.0.0. Use
+ *   xml_parser_create() and
+ *   xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'utf-8')
+ *   instead.
  */
 function drupal_xml_parser_create(&$data) {
   // Default XML encoding is UTF-8
diff --git a/core/modules/aggregator/src/Form/OpmlFeedAdd.php b/core/modules/aggregator/src/Form/OpmlFeedAdd.php
index 0ba285a9548c00d94ef33e686b3a6862f0a0e511..c78a8b73acc2c2008a1c4aa110b705a76c00f6f0 100644
--- a/core/modules/aggregator/src/Form/OpmlFeedAdd.php
+++ b/core/modules/aggregator/src/Form/OpmlFeedAdd.php
@@ -190,7 +190,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    */
   protected function parseOpml($opml) {
     $feeds = array();
-    $xml_parser = drupal_xml_parser_create($opml);
+    $xml_parser = xml_parser_create();
+    xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'utf-8');
     if (xml_parse_into_struct($xml_parser, $opml, $values)) {
       foreach ($values as $entry) {
         if ($entry['tag'] == 'OUTLINE' && isset($entry['attributes'])) {
diff --git a/core/modules/aggregator/src/Tests/AggregatorTestBase.php b/core/modules/aggregator/src/Tests/AggregatorTestBase.php
index 15be1448bc715f14152711b75bdc95598de4b9d0..9d5899d0b20b8eda8db7ddd85af1b24d65d4b7b2 100644
--- a/core/modules/aggregator/src/Tests/AggregatorTestBase.php
+++ b/core/modules/aggregator/src/Tests/AggregatorTestBase.php
@@ -271,7 +271,8 @@ public function getValidOpml(array $feeds) {
 EOF;
 
     $path = 'public://valid-opml.xml';
-    return file_unmanaged_save_data($opml, $path);
+    // Add the UTF-8 byte order mark.
+    return file_unmanaged_save_data(chr(239) . chr(187) . chr(191) . $opml, $path);
   }
 
   /**