From 80eccb189676ebba2b37de6fd7098d515b9450bf Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Mon, 3 Nov 2014 16:13:21 +0000
Subject: [PATCH] Issue #2361823 by rpayanm, javivf: Remove usage of
 drupal_strtolower().

---
 .../Drupal/Core/Database/Driver/pgsql/Schema.php    |  3 ++-
 .../src/Tests/BlockContentCreationTest.php          |  2 +-
 .../src/Tests/BlockContentFieldTest.php             |  5 +++--
 .../block_content/src/Tests/PageEditTest.php        |  3 ++-
 core/modules/color/color.module                     |  5 +++--
 .../config/src/Tests/ConfigExportImportUITest.php   |  3 ++-
 .../contact/src/Tests/ContactSitewideTest.php       | 12 ++++++------
 .../contact/src/Tests/ContactStorageTest.php        |  3 ++-
 .../datetime/src/Tests/DateTimeFieldTest.php        |  5 +++--
 .../src/EntityReferenceController.php               |  3 ++-
 .../Tests/EntityReferenceFieldDefaultValueTest.php  |  3 ++-
 .../src/Tests/EntityReferenceItemTest.php           |  5 +++--
 .../field/src/Tests/Boolean/BooleanFieldTest.php    |  3 ++-
 .../field/src/Tests/Email/EmailFieldTest.php        |  3 ++-
 .../field/src/Tests/FieldAttachStorageTest.php      |  9 +++++----
 core/modules/field/src/Tests/FieldCrudTest.php      |  3 ++-
 core/modules/field/src/Tests/FieldUnitTestBase.php  |  3 ++-
 .../field/src/Tests/Number/NumberFieldTest.php      | 13 +++++++------
 core/modules/field/src/Tests/TranslationTest.php    |  5 +++--
 core/modules/field/src/Tests/TranslationWebTest.php |  3 ++-
 core/modules/field_ui/src/Tests/FieldUiTestBase.php |  3 ++-
 core/modules/filter/src/Tests/FilterAdminTest.php   |  5 +++--
 .../filter/src/Tests/FilterDefaultFormatTest.php    |  3 ++-
 .../filter/src/Tests/FilterFormatAccessTest.php     |  3 ++-
 core/modules/filter/src/Tests/FilterHooksTest.php   |  3 ++-
 .../image/src/Tests/ImageFieldDefaultImagesTest.php |  3 ++-
 core/modules/link/src/Tests/LinkFieldTest.php       |  8 ++++----
 core/modules/link/src/Tests/LinkFieldUITest.php     |  3 ++-
 .../src/Tests/MultiStepNodeFormBasicOptionsTest.php |  3 ++-
 core/modules/node/src/Tests/NodeAccessFieldTest.php |  3 ++-
 core/modules/node/src/Tests/PagePreviewTest.php     |  3 ++-
 .../Tests/Field/TaxonomyTermReferenceRdfaTest.php   |  3 ++-
 .../src/Tests/ResponsiveImageFieldDisplayTest.php   |  3 ++-
 core/modules/search/search.module                   |  4 ++--
 .../search/src/Tests/SearchTokenizerTest.php        |  3 ++-
 .../src/Tests/Entity/EntityLanguageTestBase.php     |  5 +++--
 .../Tests/Entity/EntityQueryRelationshipTest.php    |  3 ++-
 .../system/src/Tests/Entity/EntityQueryTest.php     |  5 +++--
 .../system/src/Tests/Entity/FieldSqlStorageTest.php |  3 ++-
 .../system/src/Tests/Mail/HtmlToTextTest.php        |  2 +-
 .../src/Tests/TaxonomyTermReferenceItemTest.php     |  3 ++-
 .../modules/taxonomy/src/Tests/TaxonomyTestBase.php |  3 ++-
 .../src/Tests/TermFieldMultipleVocabularyTest.php   |  3 ++-
 core/modules/taxonomy/src/Tests/TermFieldTest.php   |  5 +++--
 core/modules/taxonomy/src/Tests/TermIndexTest.php   |  5 +++--
 .../src/Tests/Views/TaxonomyTermViewTest.php        |  3 ++-
 .../taxonomy/src/Tests/VocabularyCrudTest.php       |  5 +++--
 .../taxonomy/src/Tests/VocabularyLanguageTest.php   |  5 +++--
 .../modules/taxonomy/src/Tests/VocabularyUiTest.php |  5 +++--
 core/modules/text/src/Tests/TextFieldTest.php       |  9 +++++----
 core/modules/update/update.report.inc               |  3 ++-
 core/modules/views/src/Tests/DefaultViewsTest.php   |  5 +++--
 52 files changed, 133 insertions(+), 86 deletions(-)

diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
index 49386015b307..2190ee56f5a3 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
@@ -8,6 +8,7 @@
 namespace Drupal\Core\Database\Driver\pgsql;
 
 use Drupal\Component\Utility\String;
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Query\Condition;
 use Drupal\Core\Database\SchemaObjectExistsException;
@@ -294,7 +295,7 @@ protected function processField($field) {
     // Set the correct database-engine specific datatype.
     // In case one is already provided, force it to lowercase.
     if (isset($field['pgsql_type'])) {
-      $field['pgsql_type'] = drupal_strtolower($field['pgsql_type']);
+      $field['pgsql_type'] = Unicode::strtolower($field['pgsql_type']);
     }
     else {
       $map = $this->getFieldTypeMap();
diff --git a/core/modules/block_content/src/Tests/BlockContentCreationTest.php b/core/modules/block_content/src/Tests/BlockContentCreationTest.php
index b8314d4eca10..0262dd47eb74 100644
--- a/core/modules/block_content/src/Tests/BlockContentCreationTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentCreationTest.php
@@ -165,7 +165,7 @@ public function testBlockDelete() {
 
     // Place the block.
     $instance = array(
-      'id' => drupal_strtolower($edit['info[0][value]']),
+      'id' => Unicode::strtolower($edit['info[0][value]']),
       'settings[label]' => $edit['info[0][value]'],
       'region' => 'sidebar_first',
     );
diff --git a/core/modules/block_content/src/Tests/BlockContentFieldTest.php b/core/modules/block_content/src/Tests/BlockContentFieldTest.php
index bd967fe9b227..4fc7bf651ad7 100644
--- a/core/modules/block_content/src/Tests/BlockContentFieldTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentFieldTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\block_content\Tests;
+use Drupal\Component\Utility\Unicode;
 
 /**
  * Tests block fieldability.
@@ -55,7 +56,7 @@ public function testBlockFields() {
 
     // Create a field with settings to validate.
     $this->fieldStorage = entity_create('field_storage_config', array(
-      'field_name' => drupal_strtolower($this->randomMachineName()),
+      'field_name' => Unicode::strtolower($this->randomMachineName()),
       'entity_type' => 'block_content',
       'type' => 'link',
       'cardinality' => 2,
@@ -93,7 +94,7 @@ public function testBlockFields() {
     $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default');
     // Place the block.
     $instance = array(
-      'id' => drupal_strtolower($edit['info[0][value]']),
+      'id' => Unicode::strtolower($edit['info[0][value]']),
       'settings[label]' => $edit['info[0][value]'],
       'region' => 'sidebar_first',
     );
diff --git a/core/modules/block_content/src/Tests/PageEditTest.php b/core/modules/block_content/src/Tests/PageEditTest.php
index 9ad7662a8cfb..35775474e20e 100644
--- a/core/modules/block_content/src/Tests/PageEditTest.php
+++ b/core/modules/block_content/src/Tests/PageEditTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\block_content\Tests;
+use Drupal\Component\Utility\Unicode;
 
 /**
  * Create a block and test block edit functionality.
@@ -24,7 +25,7 @@ public function testPageEdit() {
     $body_key = 'body[0][value]';
     // Create block to edit.
     $edit = array();
-    $edit['info[0][value]'] = drupal_strtolower($this->randomMachineName(8));
+    $edit['info[0][value]'] = Unicode::strtolower($this->randomMachineName(8));
     $edit[$body_key] = $this->randomMachineName(16);
     $this->drupalPostForm('block/add/basic', $edit, t('Save'));
 
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index 0e2c57e4955a..92e21362f271 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -4,6 +4,7 @@
  * Allows users to change the color scheme of themes.
  */
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Asset\CssOptimizer;
 use Drupal\Component\Utility\Bytes;
 use Drupal\Component\Utility\Environment;
@@ -515,7 +516,7 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) {
   // Prepare color conversion table.
   $conversion = $palette;
   foreach ($conversion as $k => $v) {
-    $conversion[$k] = drupal_strtolower($v);
+    $conversion[$k] = Unicode::strtolower($v);
   }
   $default = color_get_palette($theme, TRUE);
 
@@ -534,7 +535,7 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) {
   // Iterate over all the parts.
   foreach ($style as $chunk) {
     if ($is_color) {
-      $chunk = drupal_strtolower($chunk);
+      $chunk = Unicode::strtolower($chunk);
       // Check if this is one of the colors in the default palette.
       if ($key = array_search($chunk, $default)) {
         $chunk = $conversion[$key];
diff --git a/core/modules/config/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php
index 58da46a599ec..1d33082959b6 100644
--- a/core/modules/config/src/Tests/ConfigExportImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\config\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Archiver\ArchiveTar;
 use Drupal\simpletest\WebTestBase;
 
@@ -63,7 +64,7 @@ public function testExportImport() {
     $this->content_type = $this->drupalCreateContentType();
 
     // Create a field.
-    $this->fieldName = drupal_strtolower($this->randomMachineName());
+    $this->fieldName = Unicode::strtolower($this->randomMachineName());
     $this->fieldStorage = entity_create('field_storage_config', array(
       'field_name' => $this->fieldName,
       'entity_type' => 'node',
diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php
index beee4300be78..257468de1ec6 100644
--- a/core/modules/contact/src/Tests/ContactSitewideTest.php
+++ b/core/modules/contact/src/Tests/ContactSitewideTest.php
@@ -107,13 +107,13 @@ function testSiteWideContact() {
     $recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com');
     $max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH;
     $max_length_exceeded = $max_length + 1;
-    $this->addContactForm($id = drupal_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE);
+    $this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE);
     $this->assertText(format_string('Machine-readable name cannot be longer than !max characters but is currently !exceeded characters long.', array('!max' => $max_length, '!exceeded' => $max_length_exceeded)));
-    $this->addContactForm($id = drupal_strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE);
+    $this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE);
     $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
 
     // Create first valid form.
-    $this->addContactForm($id = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0])), '', TRUE);
+    $this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0])), '', TRUE);
     $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
 
     // Check that the form was created in site default language.
@@ -148,10 +148,10 @@ function testSiteWideContact() {
     $this->drupalLogin($admin_user);
 
     // Add more forms.
-    $this->addContactForm(drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
+    $this->addContactForm(Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
     $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
 
-    $this->addContactForm($name = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
+    $this->addContactForm($name = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
     $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
 
     // Try adding a form that already exists.
@@ -221,7 +221,7 @@ function testSiteWideContact() {
 
     $label = $this->randomMachineName(16);
     $recipients = implode(',', array($recipients[0], $recipients[1], $recipients[2]));
-    $contact_form = drupal_strtolower($this->randomMachineName(16));
+    $contact_form = Unicode::strtolower($this->randomMachineName(16));
     $this->addContactForm($contact_form, $label, $recipients, '', FALSE);
     $this->drupalGet('admin/structure/contact');
     $this->clickLink(t('Edit'));
diff --git a/core/modules/contact/src/Tests/ContactStorageTest.php b/core/modules/contact/src/Tests/ContactStorageTest.php
index 741e6b56e390..79b3cfd4b046 100644
--- a/core/modules/contact/src/Tests/ContactStorageTest.php
+++ b/core/modules/contact/src/Tests/ContactStorageTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\contact\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\config\Tests\SchemaCheckTestTrait;
 use Drupal\contact\Entity\Message;
 
@@ -53,7 +54,7 @@ public function testContactStorage() {
     $this->drupalLogin($admin_user);
     // Create first valid contact form.
     $mail = 'simpletest@example.com';
-    $this->addContactForm($id = drupal_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($mail)), '', TRUE, [
+    $this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($mail)), '', TRUE, [
       'send_a_pony' => 1,
     ]);
     $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php
index 0656e7bd26df..281e78c54a0f 100644
--- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php
+++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\datetime\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Entity\Entity\EntityViewDisplay;
 use Drupal\simpletest\WebTestBase;
 use Drupal\Core\Datetime\DrupalDateTime;
@@ -52,7 +53,7 @@ protected function setUp() {
     $this->drupalLogin($web_user);
 
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     $this->fieldStorage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -283,7 +284,7 @@ function testDefaultValue() {
     $this->drupalCreateContentType(array('type' => 'date_content'));
 
     // Create a field storage with settings to validate.
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     $field_storage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'node',
diff --git a/core/modules/entity_reference/src/EntityReferenceController.php b/core/modules/entity_reference/src/EntityReferenceController.php
index b7f5d9019974..b5569431864c 100644
--- a/core/modules/entity_reference/src/EntityReferenceController.php
+++ b/core/modules/entity_reference/src/EntityReferenceController.php
@@ -8,6 +8,7 @@
 namespace Drupal\entity_reference;
 
 use Drupal\Component\Utility\Tags;
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Controller\ControllerBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\JsonResponse;
@@ -86,7 +87,7 @@ public function handleAutocomplete(Request $request, $type, $field_name, $entity
     // Get the typed string, if exists from the URL.
     $items_typed = $request->query->get('q');
     $items_typed = Tags::explode($items_typed);
-    $last_item = drupal_strtolower(array_pop($items_typed));
+    $last_item = Unicode::strtolower(array_pop($items_typed));
 
     $prefix = '';
     // The user entered a comma-separated list of entity labels, so we generate
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
index 69a19242d783..497d39e4f64b 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\entity_reference\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -42,7 +43,7 @@ function testEntityReferenceDefaultValue() {
     // Create a node to be referenced.
     $referenced_node = $this->drupalCreateNode(array('type' => 'referenced_content'));
 
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     $field_storage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'node',
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
index 4191d51cfe67..db91b599e754 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\entity_reference\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Field\FieldItemInterface;
 use Drupal\Core\Language\LanguageInterface;
@@ -51,7 +52,7 @@ protected function setUp() {
 
     $this->vocabulary = entity_create('taxonomy_vocabulary', array(
       'name' => $this->randomMachineName(),
-      'vid' => drupal_strtolower($this->randomMachineName()),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
     $this->vocabulary->save();
@@ -152,7 +153,7 @@ public function testConfigEntityReferenceItem() {
     // Make sure the computed term reflects updates to the term id.
     $vocabulary2 = entity_create('taxonomy_vocabulary', array(
       'name' => $this->randomMachineName(),
-      'vid' => drupal_strtolower($this->randomMachineName()),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
     $vocabulary2->save();
diff --git a/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php b/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php
index 9d972d32d53e..beeac25f68ee 100644
--- a/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php
+++ b/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\field\Tests\Boolean;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\simpletest\WebTestBase;
@@ -63,7 +64,7 @@ function testBooleanField() {
     $label = $this->randomMachineName();
 
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     $this->field_storage = FieldStorageConfig::create(array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
diff --git a/core/modules/field/src/Tests/Email/EmailFieldTest.php b/core/modules/field/src/Tests/Email/EmailFieldTest.php
index d8ff0516153f..2ce3c46fcde3 100644
--- a/core/modules/field/src/Tests/Email/EmailFieldTest.php
+++ b/core/modules/field/src/Tests/Email/EmailFieldTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\field\Tests\Email;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -53,7 +54,7 @@ protected function setUp() {
    */
   function testEmailField() {
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     $this->fieldStorage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
diff --git a/core/modules/field/src/Tests/FieldAttachStorageTest.php b/core/modules/field/src/Tests/FieldAttachStorageTest.php
index e6c578fcf25b..9efb2008a9d5 100644
--- a/core/modules/field/src/Tests/FieldAttachStorageTest.php
+++ b/core/modules/field/src/Tests/FieldAttachStorageTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\field\Tests;
+use Drupal\Component\Utility\Unicode;
 use Drupal\field\Entity\FieldConfig;
 
 /**
@@ -282,7 +283,7 @@ function testEntityCreateRenameBundle() {
     $cardinality = $this->fieldTestData->field_storage->getCardinality();
 
     // Create a new bundle.
-    $new_bundle = 'test_bundle_' . drupal_strtolower($this->randomMachineName());
+    $new_bundle = 'test_bundle_' . Unicode::strtolower($this->randomMachineName());
     entity_test_create_bundle($new_bundle, NULL, $entity_type);
 
     // Add a field to that bundle.
@@ -299,7 +300,7 @@ function testEntityCreateRenameBundle() {
     $this->assertEqual(count($entity->{$this->fieldTestData->field_name}), $cardinality, "Data is retrieved for the new bundle");
 
     // Rename the bundle.
-    $new_bundle = 'test_bundle_' . drupal_strtolower($this->randomMachineName());
+    $new_bundle = 'test_bundle_' . Unicode::strtolower($this->randomMachineName());
     entity_test_rename_bundle($this->fieldTestData->field_definition['bundle'], $new_bundle, $entity_type);
 
     // Check that the field definition has been updated.
@@ -321,7 +322,7 @@ function testEntityDeleteBundle() {
     $this->createFieldWithStorage('', $entity_type);
 
     // Create a new bundle.
-    $new_bundle = 'test_bundle_' . drupal_strtolower($this->randomMachineName());
+    $new_bundle = 'test_bundle_' . Unicode::strtolower($this->randomMachineName());
     entity_test_create_bundle($new_bundle, NULL, $entity_type);
 
     // Add a field to that bundle.
@@ -329,7 +330,7 @@ function testEntityDeleteBundle() {
     entity_create('field_config', $this->fieldTestData->field_definition)->save();
 
     // Create a second field for the test bundle
-    $field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
+    $field_name = Unicode::strtolower($this->randomMachineName() . '_field_name');
     $field_storage = array(
       'field_name' => $field_name,
       'entity_type' => $entity_type,
diff --git a/core/modules/field/src/Tests/FieldCrudTest.php b/core/modules/field/src/Tests/FieldCrudTest.php
index e574077bd702..40503769a55e 100644
--- a/core/modules/field/src/Tests/FieldCrudTest.php
+++ b/core/modules/field/src/Tests/FieldCrudTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\field\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Entity\EntityStorageException;
 use Drupal\Core\Field\FieldException;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -44,7 +45,7 @@ function setUp() {
     parent::setUp();
 
     $this->fieldStorageDefinition = array(
-      'field_name' => drupal_strtolower($this->randomMachineName()),
+      'field_name' => Unicode::strtolower($this->randomMachineName()),
       'entity_type' => 'entity_test',
       'type' => 'test_field',
     );
diff --git a/core/modules/field/src/Tests/FieldUnitTestBase.php b/core/modules/field/src/Tests/FieldUnitTestBase.php
index 5fadfde15788..5538a6d370c7 100644
--- a/core/modules/field/src/Tests/FieldUnitTestBase.php
+++ b/core/modules/field/src/Tests/FieldUnitTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\field\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\simpletest\KernelTestBase;
@@ -89,7 +90,7 @@ protected function createFieldWithStorage($suffix = '', $entity_type = 'entity_t
     $field = 'field' . $suffix;
     $field_definition = 'field_definition' . $suffix;
 
-    $this->fieldTestData->$field_name = drupal_strtolower($this->randomMachineName() . '_field_name' . $suffix);
+    $this->fieldTestData->$field_name = Unicode::strtolower($this->randomMachineName() . '_field_name' . $suffix);
     $this->fieldTestData->$field_storage = entity_create('field_storage_config', array(
       'field_name' => $this->fieldTestData->$field_name,
       'entity_type' => $entity_type,
diff --git a/core/modules/field/src/Tests/Number/NumberFieldTest.php b/core/modules/field/src/Tests/Number/NumberFieldTest.php
index dfec2f959906..ca1fbb084a09 100644
--- a/core/modules/field/src/Tests/Number/NumberFieldTest.php
+++ b/core/modules/field/src/Tests/Number/NumberFieldTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\field\Tests\Number;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -42,7 +43,7 @@ protected function setUp() {
    */
   function testNumberDecimalField() {
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -132,7 +133,7 @@ function testNumberIntegerField() {
     $maximum = rand(2000, 4000);
 
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -226,7 +227,7 @@ function testNumberIntegerField() {
   */
   function testNumberFloatField() {
     // Create a field with settings to validate.
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -311,9 +312,9 @@ function testNumberFloatField() {
    * Test default formatter behavior
    */
   function testNumberFormatter() {
-    $type = drupal_strtolower($this->randomMachineName());
-    $float_field = drupal_strtolower($this->randomMachineName());
-    $integer_field = drupal_strtolower($this->randomMachineName());
+    $type = Unicode::strtolower($this->randomMachineName());
+    $float_field = Unicode::strtolower($this->randomMachineName());
+    $integer_field = Unicode::strtolower($this->randomMachineName());
     $thousand_separators = array('', '.', ',', ' ', chr(8201), "'");
     $decimal_separators = array('.', ',');
     $prefix = $this->randomMachineName();
diff --git a/core/modules/field/src/Tests/TranslationTest.php b/core/modules/field/src/Tests/TranslationTest.php
index 841ab3973e5b..bbf16a6f22b7 100644
--- a/core/modules/field/src/Tests/TranslationTest.php
+++ b/core/modules/field/src/Tests/TranslationTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\field\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\language\Entity\ConfigurableLanguage;
 
 /**
@@ -75,7 +76,7 @@ protected function setUp() {
 
     $this->installConfig(array('language'));
 
-    $this->field_name = drupal_strtolower($this->randomMachineName());
+    $this->field_name = Unicode::strtolower($this->randomMachineName());
 
     $this->entity_type = 'entity_test';
 
@@ -138,7 +139,7 @@ function testTranslatableFieldSaveLoad() {
     }
 
     // Test default values.
-    $field_name_default = drupal_strtolower($this->randomMachineName() . '_field_name');
+    $field_name_default = Unicode::strtolower($this->randomMachineName() . '_field_name');
     $field_storage_definition = $this->field_storage_definition;
     $field_storage_definition['field_name'] = $field_name_default;
     $field_storage = entity_create('field_storage_config', $field_storage_definition);
diff --git a/core/modules/field/src/Tests/TranslationWebTest.php b/core/modules/field/src/Tests/TranslationWebTest.php
index 9b08388ec3ca..a5d8e09a9700 100644
--- a/core/modules/field/src/Tests/TranslationWebTest.php
+++ b/core/modules/field/src/Tests/TranslationWebTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\field\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\language\Entity\ConfigurableLanguage;
 
 /**
@@ -54,7 +55,7 @@ class TranslationWebTest extends FieldTestBase {
   protected function setUp() {
     parent::setUp();
 
-    $this->field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
+    $this->field_name = Unicode::strtolower($this->randomMachineName() . '_field_name');
 
     $field_storage = array(
       'field_name' => $this->field_name,
diff --git a/core/modules/field_ui/src/Tests/FieldUiTestBase.php b/core/modules/field_ui/src/Tests/FieldUiTestBase.php
index 314cf5b8438b..d98978d6f20e 100644
--- a/core/modules/field_ui/src/Tests/FieldUiTestBase.php
+++ b/core/modules/field_ui/src/Tests/FieldUiTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\field_ui\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\simpletest\WebTestBase;
 
@@ -38,7 +39,7 @@ protected function setUp() {
     $vocabulary = entity_create('taxonomy_vocabulary', array(
       'name' => $this->randomMachineName(),
       'description' => $this->randomMachineName(),
-      'vid' => drupal_strtolower($this->randomMachineName()),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
       'help' => '',
       'nodes' => array('article' => 'article'),
diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php
index de3ab111dd9c..77d07602d49d 100644
--- a/core/modules/filter/src/Tests/FilterAdminTest.php
+++ b/core/modules/filter/src/Tests/FilterAdminTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\filter\Tests;
 
 use Drupal\Component\Utility\String;
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -98,7 +99,7 @@ function testFormatAdmin() {
     // Add text format.
     $this->drupalGet('admin/config/content/formats');
     $this->clickLink('Add text format');
-    $format_id = drupal_strtolower($this->randomMachineName());
+    $format_id = Unicode::strtolower($this->randomMachineName());
     $name = $this->randomMachineName();
     $edit = array(
       'format' => $format_id,
@@ -231,7 +232,7 @@ function testFilterAdmin() {
 
     // Add format.
     $edit = array();
-    $edit['format'] = drupal_strtolower($this->randomMachineName());
+    $edit['format'] = Unicode::strtolower($this->randomMachineName());
     $edit['name'] = $this->randomMachineName();
     $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = 1;
     $edit['filters[' . $second_filter . '][status]'] = TRUE;
diff --git a/core/modules/filter/src/Tests/FilterDefaultFormatTest.php b/core/modules/filter/src/Tests/FilterDefaultFormatTest.php
index 5bde08e55b09..73d048dd4e2c 100644
--- a/core/modules/filter/src/Tests/FilterDefaultFormatTest.php
+++ b/core/modules/filter/src/Tests/FilterDefaultFormatTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\filter\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -34,7 +35,7 @@ function testDefaultTextFormats() {
     $formats = array();
     for ($i = 0; $i < 2; $i++) {
       $edit = array(
-        'format' => drupal_strtolower($this->randomMachineName()),
+        'format' => Unicode::strtolower($this->randomMachineName()),
         'name' => $this->randomMachineName(),
       );
       $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
diff --git a/core/modules/filter/src/Tests/FilterFormatAccessTest.php b/core/modules/filter/src/Tests/FilterFormatAccessTest.php
index 580e60c0340c..843372b6ca9f 100644
--- a/core/modules/filter/src/Tests/FilterFormatAccessTest.php
+++ b/core/modules/filter/src/Tests/FilterFormatAccessTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\filter\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Access\AccessResult;
 use Drupal\simpletest\WebTestBase;
 
@@ -86,7 +87,7 @@ protected function setUp() {
     $formats = array();
     for ($i = 0; $i < 3; $i++) {
       $edit = array(
-        'format' => drupal_strtolower($this->randomMachineName()),
+        'format' => Unicode::strtolower($this->randomMachineName()),
         'name' => $this->randomMachineName(),
       );
       $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
diff --git a/core/modules/filter/src/Tests/FilterHooksTest.php b/core/modules/filter/src/Tests/FilterHooksTest.php
index a5f142b0a7b6..4b91a31065b3 100644
--- a/core/modules/filter/src/Tests/FilterHooksTest.php
+++ b/core/modules/filter/src/Tests/FilterHooksTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\filter\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -41,7 +42,7 @@ function testFilterHooks() {
     // Add a text format.
     $name = $this->randomMachineName();
     $edit = array();
-    $edit['format'] = drupal_strtolower($this->randomMachineName());
+    $edit['format'] = Unicode::strtolower($this->randomMachineName());
     $edit['name'] = $name;
     $edit['roles[' . DRUPAL_ANONYMOUS_RID . ']'] = 1;
     $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
diff --git a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
index 2c1ea0e5daa7..b987f486940f 100644
--- a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
+++ b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\image\Tests;
+use Drupal\Component\Utility\Unicode;
 use Drupal\file\Entity\File;
 
 /**
@@ -300,7 +301,7 @@ public function testDefaultImages() {
    */
   public function testInvalidDefaultImage() {
     $field_storage = entity_create('field_storage_config', array(
-      'field_name' => drupal_strtolower($this->randomMachineName()),
+      'field_name' => Unicode::strtolower($this->randomMachineName()),
       'entity_type' => 'node',
       'type' => 'image',
       'settings' => array(
diff --git a/core/modules/link/src/Tests/LinkFieldTest.php b/core/modules/link/src/Tests/LinkFieldTest.php
index 223acdbdebc6..7a4b09688812 100644
--- a/core/modules/link/src/Tests/LinkFieldTest.php
+++ b/core/modules/link/src/Tests/LinkFieldTest.php
@@ -62,7 +62,7 @@ protected function setUp() {
    * Tests link field URL validation.
    */
   function testURLValidation() {
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     // Create a field with settings to validate.
     $this->fieldStorage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
@@ -182,7 +182,7 @@ protected function assertInvalidEntries($field_name, array $invalid_entries) {
    * Tests the link title settings of a link field.
    */
   function testLinkTitle() {
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     // Create a field with settings to validate.
     $this->fieldStorage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
@@ -296,7 +296,7 @@ function testLinkTitle() {
    * Tests the default 'link' formatter.
    */
   function testLinkFormatter() {
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     // Create a field with settings to validate.
     $this->fieldStorage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
@@ -436,7 +436,7 @@ function testLinkFormatter() {
    * merged, since they involve different configuration and output.
    */
   function testLinkSeparateFormatter() {
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     // Create a field with settings to validate.
     $this->fieldStorage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
diff --git a/core/modules/link/src/Tests/LinkFieldUITest.php b/core/modules/link/src/Tests/LinkFieldUITest.php
index e057c05340c4..6a367423e7c0 100644
--- a/core/modules/link/src/Tests/LinkFieldUITest.php
+++ b/core/modules/link/src/Tests/LinkFieldUITest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\link\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -40,7 +41,7 @@ function testFieldUI() {
 
     // Add a link field to the newly-created type.
     $label = $this->randomMachineName();
-    $field_name = drupal_strtolower($label);
+    $field_name = Unicode::strtolower($label);
     $edit = array(
       'fields[_add_new_field][label]' => $label,
       'fields[_add_new_field][field_name]' => $field_name,
diff --git a/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php b/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php
index 38a06dd8962e..4650bad45042 100644
--- a/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php
+++ b/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\node\Tests;
+use Drupal\Component\Utility\Unicode;
 
 /**
  * Tests the persistence of basic options through multiple steps.
@@ -30,7 +31,7 @@ function testMultiStepNodeFormBasicOptions() {
     $this->drupalLogin($web_user);
 
     // Create an unlimited cardinality field.
-    $this->field_name = drupal_strtolower($this->randomMachineName());
+    $this->field_name = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $this->field_name,
       'entity_type' => 'node',
diff --git a/core/modules/node/src/Tests/NodeAccessFieldTest.php b/core/modules/node/src/Tests/NodeAccessFieldTest.php
index 709ba29c8ead..43e7aaadeb60 100644
--- a/core/modules/node/src/Tests/NodeAccessFieldTest.php
+++ b/core/modules/node/src/Tests/NodeAccessFieldTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\node\Tests;
+use Drupal\Component\Utility\Unicode;
 
 /**
  * Tests the interaction of the node access system with fields.
@@ -52,7 +53,7 @@ protected function setUp() {
     $this->content_admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer node fields'));
 
     // Add a custom field to the page content type.
-    $this->field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
+    $this->field_name = Unicode::strtolower($this->randomMachineName() . '_field_name');
     entity_create('field_storage_config', array(
       'field_name' => $this->field_name,
       'entity_type' => 'node',
diff --git a/core/modules/node/src/Tests/PagePreviewTest.php b/core/modules/node/src/Tests/PagePreviewTest.php
index 0a78f7623c1d..5fc64d306c20 100644
--- a/core/modules/node/src/Tests/PagePreviewTest.php
+++ b/core/modules/node/src/Tests/PagePreviewTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\node\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\node\Entity\NodeType;
 
@@ -61,7 +62,7 @@ protected function setUp() {
     $this->term = $term;
 
     // Create a field.
-    $this->field_name = drupal_strtolower($this->randomMachineName());
+    $this->field_name = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $this->field_name,
       'entity_type' => 'node',
diff --git a/core/modules/rdf/src/Tests/Field/TaxonomyTermReferenceRdfaTest.php b/core/modules/rdf/src/Tests/Field/TaxonomyTermReferenceRdfaTest.php
index f36eefdf8a1d..1bceeffaabe9 100644
--- a/core/modules/rdf/src/Tests/Field/TaxonomyTermReferenceRdfaTest.php
+++ b/core/modules/rdf/src/Tests/Field/TaxonomyTermReferenceRdfaTest.php
@@ -6,6 +6,7 @@
 
 namespace Drupal\rdf\Tests\Field;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\user\Entity\Role;
@@ -48,7 +49,7 @@ protected function setUp() {
 
     $vocabulary = entity_create('taxonomy_vocabulary', array(
       'name' => $this->randomMachineName(),
-      'vid' => drupal_strtolower($this->randomMachineName()),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
     $vocabulary->save();
diff --git a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
index 9759544d96ba..5f85234e4c4e 100644
--- a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
+++ b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\responsive_image\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\image\Tests\ImageFieldTestBase;
 
 /**
@@ -79,7 +80,7 @@ public function testResponsiveImageFieldFormattersPrivate() {
    * Test responsive image formatters on node display.
    */
   public function _testResponsiveImageFieldFormatters($scheme) {
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     $this->createImageField($field_name, 'article', array('uri_scheme' => $scheme));
     // Create a new node with an image attached.
     $test_image = current($this->drupalGetTestFiles('image'));
diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index 385bbe3018af..e780087b0618 100644
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -244,7 +244,7 @@ function search_simplify($text, $langcode = NULL) {
   $text = String::decodeEntities($text);
 
   // Lowercase
-  $text = drupal_strtolower($text);
+  $text = Unicode::strtolower($text);
 
   // Call an external processor for word handling.
   search_invoke_preprocess($text, $langcode);
@@ -415,7 +415,7 @@ function search_index($sid, $type, $text, $langcode) {
     if ($tag) {
       // Increase or decrease score per word based on tag
       list($tagname) = explode(' ', $value, 2);
-      $tagname = drupal_strtolower($tagname);
+      $tagname = Unicode::strtolower($tagname);
       // Closing or opening tag?
       if ($tagname[0] == '/') {
         $tagname = substr($tagname, 1);
diff --git a/core/modules/search/src/Tests/SearchTokenizerTest.php b/core/modules/search/src/Tests/SearchTokenizerTest.php
index 360bc70060ce..66777b3be117 100644
--- a/core/modules/search/src/Tests/SearchTokenizerTest.php
+++ b/core/modules/search/src/Tests/SearchTokenizerTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\search\Tests;
+use Drupal\Component\Utility\Unicode;
 
 /**
  * Tests that CJK tokenizer works as intended.
@@ -97,7 +98,7 @@ function testTokenizer() {
     // Merge into a string and tokenize.
     $string = implode('', $chars);
     $out = trim(search_simplify($string));
-    $expected = drupal_strtolower(implode(' ', $chars));
+    $expected = Unicode::strtolower(implode(' ', $chars));
 
     // Verify that the output matches what we expect.
     $this->assertEqual($out, $expected, 'CJK tokenizer worked on all supplied CJK characters');
diff --git a/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php b/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php
index 28c4f713eae1..9be0ba3368a8 100644
--- a/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php
+++ b/core/modules/system/src/Tests/Entity/EntityLanguageTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Entity;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\field\Entity\FieldConfig;
 
@@ -63,10 +64,10 @@ protected function setUp() {
     $this->state->set('entity_test.translation', TRUE);
 
     // Create a translatable test field.
-    $this->field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
+    $this->field_name = Unicode::strtolower($this->randomMachineName() . '_field_name');
 
     // Create an untranslatable test field.
-    $this->untranslatable_field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
+    $this->untranslatable_field_name = Unicode::strtolower($this->randomMachineName() . '_field_name');
 
     // Create field fields in all entity variations.
     foreach (entity_test_entity_types() as $entity_type) {
diff --git a/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php b/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
index a6dfa44c7329..04def245b595 100644
--- a/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityQueryRelationshipTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\system\Tests\Entity;
+use Drupal\Component\Utility\Unicode;
 
 /**
  * Tests the Entity Query relationship API.
@@ -69,7 +70,7 @@ protected function setUp() {
     // We want a taxonomy term reference field. It needs a vocabulary, terms,
     // a field storage and a field. First, create the vocabulary.
     $vocabulary = entity_create('taxonomy_vocabulary', array(
-      'vid' => drupal_strtolower($this->randomMachineName()),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
     ));
     $vocabulary->save();
     // Second, create the field.
diff --git a/core/modules/system/src/Tests/Entity/EntityQueryTest.php b/core/modules/system/src/Tests/Entity/EntityQueryTest.php
index d045cb38471e..422bfa7c1f05 100644
--- a/core/modules/system/src/Tests/Entity/EntityQueryTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityQueryTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Entity;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\language\Entity\ConfigurableLanguage;
 use Symfony\Component\HttpFoundation\Request;
@@ -56,8 +57,8 @@ protected function setUp() {
 
     $this->installConfig(array('language'));
 
-    $figures = drupal_strtolower($this->randomMachineName());
-    $greetings = drupal_strtolower($this->randomMachineName());
+    $figures = Unicode::strtolower($this->randomMachineName());
+    $greetings = Unicode::strtolower($this->randomMachineName());
     foreach (array($figures => 'shape', $greetings => 'text') as $field_name => $field_type) {
       $field_storage = entity_create('field_storage_config', array(
         'field_name' => $field_name,
diff --git a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
index 6d487bea8c4d..8fdb484f3ee8 100644
--- a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
+++ b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Entity;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -276,7 +277,7 @@ function testLongNames() {
     $storage = $this->container->get('entity.manager')->getStorage($entity_type);
 
     // Create two fields and generate random values.
-    $name_base = drupal_strtolower($this->randomMachineName(FieldStorageConfig::NAME_MAX_LENGTH - 1));
+    $name_base = Unicode::strtolower($this->randomMachineName(FieldStorageConfig::NAME_MAX_LENGTH - 1));
     $field_names = array();
     $values = array();
     for ($i = 0; $i < 2; $i++) {
diff --git a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
index 0b8315cb254b..e95e0b5d924b 100644
--- a/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
+++ b/core/modules/system/src/Tests/Mail/HtmlToTextTest.php
@@ -51,7 +51,7 @@ protected function stringToHtml($text) {
    *   set of tags supported by drupal_html_to_text().
    */
   protected function assertHtmlToText($html, $text, $message, $allowed_tags = NULL) {
-    preg_match_all('/<([a-z0-6]+)/', drupal_strtolower($html), $matches);
+    preg_match_all('/<([a-z0-6]+)/', Unicode::strtolower($html), $matches);
     $tested_tags = implode(', ', array_unique($matches[1]));
     $message .= ' (' . $tested_tags . ')';
     $result = drupal_html_to_text($html, $allowed_tags);
diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTermReferenceItemTest.php b/core/modules/taxonomy/src/Tests/TaxonomyTermReferenceItemTest.php
index 8665b1158096..ef5617edef2c 100644
--- a/core/modules/taxonomy/src/Tests/TaxonomyTermReferenceItemTest.php
+++ b/core/modules/taxonomy/src/Tests/TaxonomyTermReferenceItemTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Field\FieldItemInterface;
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
@@ -41,7 +42,7 @@ protected function setUp() {
 
     $vocabulary = entity_create('taxonomy_vocabulary', array(
       'name' => $this->randomMachineName(),
-      'vid' => drupal_strtolower($this->randomMachineName()),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
     ));
     $vocabulary->save();
diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php b/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php
index ae791dab49a9..396c1f83c44a 100644
--- a/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php
+++ b/core/modules/taxonomy/src/Tests/TaxonomyTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\simpletest\WebTestBase;
 use Drupal\taxonomy\Entity\Vocabulary;
@@ -40,7 +41,7 @@ function createVocabulary() {
     $vocabulary = entity_create('taxonomy_vocabulary', array(
       'name' => $this->randomMachineName(),
       'description' => $this->randomMachineName(),
-      'vid' => drupal_strtolower($this->randomMachineName()),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
       'weight' => mt_rand(0, 10),
     ));
diff --git a/core/modules/taxonomy/src/Tests/TermFieldMultipleVocabularyTest.php b/core/modules/taxonomy/src/Tests/TermFieldMultipleVocabularyTest.php
index d7ee8a13bd05..98ee8351d430 100644
--- a/core/modules/taxonomy/src/Tests/TermFieldMultipleVocabularyTest.php
+++ b/core/modules/taxonomy/src/Tests/TermFieldMultipleVocabularyTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\field\Entity\FieldStorageConfig;
 
@@ -36,7 +37,7 @@ protected function setUp() {
     $this->vocabulary2 = $this->createVocabulary();
 
     // Set up a field storage and a field.
-    $this->field_name = drupal_strtolower($this->randomMachineName());
+    $this->field_name = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $this->field_name,
       'entity_type' => 'entity_test',
diff --git a/core/modules/taxonomy/src/Tests/TermFieldTest.php b/core/modules/taxonomy/src/Tests/TermFieldTest.php
index 10c950c784c1..50d23e8e4060 100644
--- a/core/modules/taxonomy/src/Tests/TermFieldTest.php
+++ b/core/modules/taxonomy/src/Tests/TermFieldTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\field\Entity\FieldStorageConfig;
 
 /**
@@ -45,7 +46,7 @@ protected function setUp() {
     $this->vocabulary = $this->createVocabulary();
 
     // Setup a field.
-    $this->field_name = drupal_strtolower($this->randomMachineName());
+    $this->field_name = Unicode::strtolower($this->randomMachineName());
     $this->field_storage = entity_create('field_storage_config', array(
       'field_name' => $this->field_name,
       'entity_type' => 'entity_test',
@@ -164,7 +165,7 @@ function testTaxonomyTermFieldChangeMachineName() {
     );
     $this->field_storage->save();
     // Change the machine name.
-    $new_name = drupal_strtolower($this->randomMachineName());
+    $new_name = Unicode::strtolower($this->randomMachineName());
     $this->vocabulary->vid = $new_name;
     $this->vocabulary->save();
 
diff --git a/core/modules/taxonomy/src/Tests/TermIndexTest.php b/core/modules/taxonomy/src/Tests/TermIndexTest.php
index 26e423b44c51..3121a8e8a27b 100644
--- a/core/modules/taxonomy/src/Tests/TermIndexTest.php
+++ b/core/modules/taxonomy/src/Tests/TermIndexTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 
@@ -34,7 +35,7 @@ protected function setUp() {
     // Create a vocabulary and add two term reference fields to article nodes.
     $this->vocabulary = $this->createVocabulary();
 
-    $this->field_name_1 = drupal_strtolower($this->randomMachineName());
+    $this->field_name_1 = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $this->field_name_1,
       'entity_type' => 'node',
@@ -65,7 +66,7 @@ protected function setUp() {
       ))
       ->save();
 
-    $this->field_name_2 = drupal_strtolower($this->randomMachineName());
+    $this->field_name_2 = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $this->field_name_2,
       'entity_type' => 'node',
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php
index 2ca806218499..59b6224f9c87 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests\Views;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Language\Language;
 use Drupal\language\Entity\ConfigurableLanguage;
@@ -38,7 +39,7 @@ protected function setUp() {
 
     // Create a vocabulary and add two term reference fields to article nodes.
 
-    $this->field_name_1 = drupal_strtolower($this->randomMachineName());
+    $this->field_name_1 = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $this->field_name_1,
       'entity_type' => 'node',
diff --git a/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php b/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php
index adb35f71d5a9..b167840ed2ed 100644
--- a/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php
+++ b/core/modules/taxonomy/src/Tests/VocabularyCrudTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\field\Entity\FieldConfig;
 
 /**
@@ -157,7 +158,7 @@ function testTaxonomyVocabularyChangeMachineName() {
 
     // Change the machine name.
     $old_name = $this->vocabulary->id();
-    $new_name = drupal_strtolower($this->randomMachineName());
+    $new_name = Unicode::strtolower($this->randomMachineName());
     $this->vocabulary->vid = $new_name;
     $this->vocabulary->save();
 
@@ -176,7 +177,7 @@ function testTaxonomyVocabularyChangeMachineName() {
   function testUninstallReinstall() {
     // Field storages and fields attached to taxonomy term bundles should be
     // removed when the module is uninstalled.
-    $field_name = drupal_strtolower($this->randomMachineName() . '_field_name');
+    $field_name = Unicode::strtolower($this->randomMachineName() . '_field_name');
     $storage_definition = array(
       'field_name' => $field_name,
       'entity_type' => 'taxonomy_term',
diff --git a/core/modules/taxonomy/src/Tests/VocabularyLanguageTest.php b/core/modules/taxonomy/src/Tests/VocabularyLanguageTest.php
index 0b400e731fff..07e3831b44b2 100644
--- a/core/modules/taxonomy/src/Tests/VocabularyLanguageTest.php
+++ b/core/modules/taxonomy/src/Tests/VocabularyLanguageTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\language\Entity\ConfigurableLanguage;
 
 /**
@@ -47,7 +48,7 @@ function testVocabularyLanguage() {
     $this->assertField('edit-langcode', 'The language selector field was found on the page.');
 
     // Create the vocabulary.
-    $vid = drupal_strtolower($this->randomMachineName());
+    $vid = Unicode::strtolower($this->randomMachineName());
     $edit['name'] = $this->randomMachineName();
     $edit['description'] = $this->randomMachineName();
     $edit['langcode'] = 'aa';
@@ -76,7 +77,7 @@ function testVocabularyDefaultLanguageForTerms() {
     // the terms are saved.
     $edit = array(
       'name' => $this->randomMachineName(),
-      'vid' => drupal_strtolower($this->randomMachineName()),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
       'default_language[langcode]' => 'bb',
       'default_language[language_show]' => TRUE,
     );
diff --git a/core/modules/taxonomy/src/Tests/VocabularyUiTest.php b/core/modules/taxonomy/src/Tests/VocabularyUiTest.php
index 6e3700a4321a..134bb363aa22 100644
--- a/core/modules/taxonomy/src/Tests/VocabularyUiTest.php
+++ b/core/modules/taxonomy/src/Tests/VocabularyUiTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\taxonomy\Tests;
+use Drupal\Component\Utility\Unicode;
 
 /**
  * Tests the taxonomy vocabulary interface.
@@ -31,7 +32,7 @@ function testVocabularyInterface() {
     // Create a new vocabulary.
     $this->clickLink(t('Add vocabulary'));
     $edit = array();
-    $vid = drupal_strtolower($this->randomMachineName());
+    $vid = Unicode::strtolower($this->randomMachineName());
     $edit['name'] = $this->randomMachineName();
     $edit['description'] = $this->randomMachineName();
     $edit['vid'] = $vid;
@@ -120,7 +121,7 @@ function testTaxonomyAdminNoVocabularies() {
    */
   function testTaxonomyAdminDeletingVocabulary() {
     // Create a vocabulary.
-    $vid = drupal_strtolower($this->randomMachineName());
+    $vid = Unicode::strtolower($this->randomMachineName());
     $edit = array(
       'name' => $this->randomMachineName(),
       'vid' => $vid,
diff --git a/core/modules/text/src/Tests/TextFieldTest.php b/core/modules/text/src/Tests/TextFieldTest.php
index 905f737af334..e771af9e851a 100644
--- a/core/modules/text/src/Tests/TextFieldTest.php
+++ b/core/modules/text/src/Tests/TextFieldTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\text\Tests;
 
 use Drupal\Component\Utility\String;
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -43,7 +44,7 @@ protected function setUp() {
   function testTextFieldValidation() {
     // Create a field with settings to validate.
     $max_length = 3;
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     $field_storage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -85,7 +86,7 @@ function testTextfieldWidgets() {
    */
   function _testTextfieldWidgets($field_type, $widget_type) {
     // Create a field.
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     $field_storage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -146,7 +147,7 @@ function testTextfieldWidgetsFormatted() {
    */
   function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     // Create a field.
-    $field_name = drupal_strtolower($this->randomMachineName());
+    $field_name = Unicode::strtolower($this->randomMachineName());
     $field_storage = entity_create('field_storage_config', array(
       'field_name' => $field_name,
       'entity_type' => 'entity_test',
@@ -204,7 +205,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     // access to it.
     $this->drupalLogin($this->admin_user);
     $edit = array(
-      'format' => drupal_strtolower($this->randomMachineName()),
+      'format' => Unicode::strtolower($this->randomMachineName()),
       'name' => $this->randomMachineName(),
     );
     $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc
index 38c724c45f42..61146b45df14 100644
--- a/core/modules/update/update.report.inc
+++ b/core/modules/update/update.report.inc
@@ -5,6 +5,7 @@
  * Code required only when rendering the available updates report.
  */
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Template\Attribute;
 use Drupal\Core\Url;
 
@@ -67,7 +68,7 @@ function template_preprocess_update_report(&$variables) {
         '#attributes' => array('class' => array('update')),
       );
     }
-    $row_key = !empty($project['title']) ? drupal_strtolower($project['title']) : drupal_strtolower($project['name']);
+    $row_key = !empty($project['title']) ? Unicode::strtolower($project['title']) : Unicode::strtolower($project['name']);
 
     // Add the project status row and details.
     $rows[$project['project_type']][$row_key]['status'] = $project_status;
diff --git a/core/modules/views/src/Tests/DefaultViewsTest.php b/core/modules/views/src/Tests/DefaultViewsTest.php
index 1f75f7d8fb56..15b49a42dc8e 100644
--- a/core/modules/views/src/Tests/DefaultViewsTest.php
+++ b/core/modules/views/src/Tests/DefaultViewsTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\views\Tests;
 
 use Drupal\comment\CommentInterface;
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Url;
 use Drupal\simpletest\WebTestBase;
@@ -48,7 +49,7 @@ protected function setUp() {
     $this->vocabulary = entity_create('taxonomy_vocabulary', array(
       'name' => $this->randomMachineName(),
       'description' => $this->randomMachineName(),
-      'vid' => drupal_strtolower($this->randomMachineName()),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
       'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
       'help' => '',
       'nodes' => array('page' => 'page'),
@@ -57,7 +58,7 @@ protected function setUp() {
     $this->vocabulary->save();
 
     // Create a field.
-    $this->field_name = drupal_strtolower($this->randomMachineName());
+    $this->field_name = Unicode::strtolower($this->randomMachineName());
     entity_create('field_storage_config', array(
       'field_name' => $this->field_name,
       'entity_type' => 'node',
-- 
GitLab