diff --git a/core/lib/Drupal/Component/Utility/Unicode.php b/core/lib/Drupal/Component/Utility/Unicode.php
index 75ffa1b..e2227d0 100644
--- a/core/lib/Drupal/Component/Utility/Unicode.php
+++ b/core/lib/Drupal/Component/Utility/Unicode.php
@@ -141,7 +141,8 @@ public static function setStatus($status) {
    *
    * Because of the need to be able to handle text in various encodings, we do
    * not support mbstring function overloading. HTTP input/output conversion
-   * must be disabled for similar reasons.
+   * must be disabled for similar reasons. Additionally, we check that encoding-
+   * related parameters are correctly set for PHP versions 5.6 and up.
    *
    * @return string
    *   A string identifier of a failed multibyte extension check, if any.
@@ -155,26 +156,58 @@ public static function check() {
     }
 
     // Check mbstring configuration.
-    if (ini_get('mbstring.func_overload') != 0) {
+    if (static::iniGet('mbstring.func_overload') != 0) {
       static::$status = static::STATUS_ERROR;
       return 'mbstring.func_overload';
     }
-    if (ini_get('mbstring.encoding_translation') != 0) {
+    if (static::iniGet('mbstring.encoding_translation') != 0) {
       static::$status = static::STATUS_ERROR;
       return 'mbstring.encoding_translation';
     }
     // mbstring.http_input and mbstring.http_output are deprecated and empty by
     // default in PHP 5.6.
-    if (version_compare(PHP_VERSION, '5.6.0') == -1) {
-      if (ini_get('mbstring.http_input') != 'pass') {
+    if (version_compare(static::getPhpVersion(), '5.6.0') == -1) {
+      if (static::iniGet('mbstring.http_input') != 'pass') {
         static::$status = static::STATUS_ERROR;
         return 'mbstring.http_input';
       }
-      if (ini_get('mbstring.http_output') != 'pass') {
+      if (static::iniGet('mbstring.http_output') != 'pass') {
         static::$status = static::STATUS_ERROR;
         return 'mbstring.http_output';
       }
     }
+    if (version_compare(static::getPhpVersion(), '5.6.0') >= 0) {
+      // Check encoding settings for PHP versions 5.6 and up.
+      $php_encoding_settings = array(
+        'php.internal_encoding',
+        'php.input_encoding',
+        'php.output_encoding',
+      );
+      foreach ($php_encoding_settings as $php_encoding_setting) {
+        if (strtolower(static::iniGet($php_encoding_setting)) != 'utf-8') {
+          static::$status = static::STATUS_ERROR;
+          return $php_encoding_setting;
+        }
+      }
+
+      $deprecated_encoding_settings = array(
+        'iconv.internal_encoding',
+        'iconv.input_encoding',
+        'iconv.output_encoding',
+        'mbstring.internal_encoding',
+        'mbstring.http_input',
+        'mbstring.http_output',
+      );
+      foreach ($deprecated_encoding_settings as $deprecated_encoding_setting) {
+        // Deprecated parameters must be either not set, or set to UTF-8.
+        if (static::iniGet($deprecated_encoding_setting) !== FALSE && strtolower(static::iniGet($deprecated_encoding_setting)) != 'utf-8') {
+          if (!(in_array($deprecated_encoding_setting, array('mbstring.http_input', 'mbstring.http_output')) && static::iniGet($deprecated_encoding_setting) == 'pass')) {
+            static::$status = static::STATUS_ERROR;
+            return $deprecated_encoding_setting;
+          }
+        }
+      }
+    }
 
     // Set appropriate configuration.
     mb_internal_encoding('utf-8');
@@ -184,6 +217,34 @@ public static function check() {
   }
 
   /**
+   * Wrapper for the constant with the current PHP version.
+   *
+   * We wrap this in order to allow PHP version overrides in tests.
+   *
+   * @return string
+   *   The current PHP version.
+   */
+  protected static function getPhpVersion() {
+    return PHP_VERSION;
+  }
+
+  /**
+   * Wrapper for ini_get().
+   *
+   * We wrap this in order to allow ini_get() overrides in tests as setting
+   * certain variables through ini_set() is not possible in PHP scripts.
+   *
+   * @var string $variable_name
+   *   The variable name to pass to ini_get().
+   *
+   * @return string
+   *   The value of the variable.
+   */
+  protected static function iniGet($variable_name) {
+    return ini_get($variable_name);
+  }
+
+  /**
    * Converts data to UTF-8.
    *
    * Requires the iconv, GNU recode or mbstring PHP extension.
diff --git a/core/tests/Drupal/Tests/Component/Utility/Stub/StubUnicode.php b/core/tests/Drupal/Tests/Component/Utility/Stub/StubUnicode.php
new file mode 100644
index 0000000..8ca1fe1
--- /dev/null
+++ b/core/tests/Drupal/Tests/Component/Utility/Stub/StubUnicode.php
@@ -0,0 +1,68 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Component\Utility\Stub\StubUnicode
+ */
+namespace Drupal\Tests\Component\Utility\Stub;
+
+use Drupal\Component\Utility\Unicode;
+
+/**
+ * A stub of the Unicode class for testing purposes.
+ *
+ * @see \Drupal\Tests\Component\Utility\Unicode
+ */
+
+class StubUnicode extends Unicode {
+
+  /**
+   * Holds the current php.ini variable to override.
+   *
+   * @var array
+   *   Associative array with keys:
+   *   - variable_name: string with name for current variable.
+   *   - variable_value: string with value for current variable.
+   */
+  public static $currentIniVariable;
+
+  /**
+   * Holds the current PHP version to override.
+   *
+   * @var string
+   *   PHP version override.
+   */
+  public static $currentPhpVersion;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function iniGet($variable_name) {
+    if ($variable_name == static::$currentIniVariable['variable_name']) {
+      // Override the "current" variable that we are testing only.
+      return static::$currentIniVariable['variable_value'];
+    }
+    else {
+      // Return a value that should pass tests.
+      $map = array(
+          'mbstring.func_overload' => 0,
+          'mbstring.encoding_translation' => 0,
+          'mbstring.http_input' => 'pass',
+          'mbstring.http_output' => 'pass',
+          'php.internal_encoding' => 'utf-8',
+          'php.input_encoding' => 'utf-8',
+          'php.output_encoding' => 'utf-8',
+          'iconv.output_encoding' => FALSE,
+          'iconv.internal_encoding' => FALSE,
+          'iconv.input_encoding' => FALSE,
+          'mbstring.internal_encoding' => FALSE,
+      );
+      return $map[$variable_name];
+    }
+  }
+
+  public static function getPhpVersion() {
+    return static::$currentPhpVersion;
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
index 724d875..c29342b 100644
--- a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
@@ -9,6 +9,7 @@
 
 use Drupal\Tests\UnitTestCase;
 use Drupal\Component\Utility\Unicode;
+use Drupal\Tests\Component\Utility\Stub\StubUnicode;
 
 /**
  * Test unicode handling features implemented in Unicode component.
@@ -30,6 +31,80 @@ public function setUp() {
   }
 
   /**
+   * Unit test for the check() method.
+   *
+   * @param string $fake_php_version
+   *   The PHP version to fake.
+   * @param string $variable_name
+   *   The name of the php.ini variable to set.
+   * @param string|bool $new_value
+   *   The new value of the php.ini value to set.
+   * @param bool $passes_check
+   *   Whether the test passes (TRUE) or not (FALSE).
+   *
+   * @dataProvider providerCheck
+   * @covers ::check
+   */
+  public function testCheck($fake_php_version, $variable_name, $new_value, $passes_check) {
+
+    // Save the current variable into a property so we can access it
+    // in StubUnicode::iniGet().
+    StubUnicode::$currentIniVariable = array(
+      'variable_name' => $variable_name,
+      'variable_value' => $new_value,
+    );
+    StubUnicode::$currentPhpVersion = $fake_php_version;
+
+    $check = StubUnicode::check();
+
+    if ($passes_check) {
+      // Make sure the check() method returns NULL if successful.
+      $this->assertEquals($check, NULL);
+    }
+    else {
+      // Make sure the check() method returns the variable name if
+      // not successful.
+      $this->assertEquals($check, $variable_name);
+    }
+
+  }
+
+
+  /**
+   * Data provider for testCheck().
+   *
+   * @see testCheck()
+   */
+  public function providerCheck() {
+    return [
+      [ '5.6.0', 'mbstring.func_overload', '0', TRUE ],
+      [ '5.6.0', 'mbstring.func_overload', '1', FALSE ],
+      [ '5.6.0', 'mbstring.encoding_translation', '0', TRUE ],
+      [ '5.6.0', 'mbstring.encoding_translation', '1', FALSE ],
+      [ '5.4.0', 'mbstring.http_input', 'pass', TRUE ],
+      [ '5.4.0', 'mbstring.http_input', 'iso-8859-1', FALSE ],
+      [ '5.4.0', 'mbstring.http_output', 'pass', TRUE ],
+      [ '5.4.0', 'mbstring.http_output', 'iso-8859-1', FALSE ],
+      [ '5.6.0', 'mbstring.http_input', 'pass', TRUE ],
+      [ '5.6.0', 'mbstring.http_input', 'utf-8', TRUE ],
+      [ '5.6.0', 'mbstring.http_input', 'iso-8859-1', FALSE ],
+      [ '5.6.0', 'mbstring.http_output', 'pass', TRUE ],
+      [ '5.6.0', 'mbstring.http_output', 'utf-8', TRUE ],
+      [ '5.6.0', 'mbstring.http_output', 'iso-8859-1', FALSE ],
+      [ '5.6.0', 'php.input_encoding', 'UTF-8', TRUE ],
+      [ '5.6.0', 'php.input_encoding', 'iso-8859-1', FALSE ],
+      [ '5.6.0', 'php.output_encoding', 'UTF-8', TRUE ],
+      [ '5.6.0', 'php.output_encoding', 'iso-8859-1', FALSE ],
+      [ '5.6.0', 'php.internal_encoding', 'utf-8', TRUE ],
+      [ '5.6.0', 'php.internal_encoding', 'iso-8859-1', FALSE ],
+      [ '5.6.0', 'iconv.internal_encoding', 'utf-8', TRUE ],
+      [ '5.6.0', 'iconv.internal_encoding', 'iso-8859-1', FALSE ],
+      [ '5.6.0', 'mbstring.internal_encoding', 'utf-8', TRUE ],
+      [ '5.6.0', 'mbstring.internal_encoding', 'iso-8859-1', FALSE ],
+    ];
+  }
+
+  /**
    * Getting and settings the multibyte environment status.
    *
    * @dataProvider providerTestStatus
