diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php
index e73a34f..58e5d25 100644
--- a/core/lib/Drupal/Core/Field/WidgetBase.php
+++ b/core/lib/Drupal/Core/Field/WidgetBase.php
@@ -9,6 +9,7 @@
 
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Component\Utility\SortArray;
+use Drupal\Component\Utility\String;
 use Symfony\Component\Validator\ConstraintViolationInterface;
 
 /**
@@ -74,7 +75,7 @@ public function form(FieldItemListInterface $items, array &$form, array &$form_s
     if ($this->handlesMultipleValues() || isset($get_delta)) {
       $delta = isset($get_delta) ? $get_delta : 0;
       $element = array(
-        '#title' => check_plain($this->fieldDefinition->getLabel()),
+        '#title' => String::checkPlain($this->fieldDefinition->getLabel()),
         '#description' => field_filter_xss(\Drupal::token()->replace($this->fieldDefinition->getDescription())),
       );
       $element = $this->formSingleElement($items, $delta, $element, $form, $form_state);
@@ -161,7 +162,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f
     $id_prefix = implode('-', array_merge($parents, array($field_name)));
     $wrapper_id = drupal_html_id($id_prefix . '-add-more-wrapper');
 
-    $title = check_plain($this->fieldDefinition->getLabel());
+    $title = String::checkPlain($this->fieldDefinition->getLabel());
     $description = field_filter_xss(\Drupal::token()->replace($this->fieldDefinition->getDescription()));
 
     $elements = array();
diff --git a/core/modules/action/action.views_execution.inc b/core/modules/action/action.views_execution.inc
index 859cffd..400d738 100644
--- a/core/modules/action/action.views_execution.inc
+++ b/core/modules/action/action.views_execution.inc
@@ -5,12 +5,14 @@
  * Provides views runtime hooks for action.module.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Implements hook_views_form_substitutions().
  */
 function action_views_form_substitutions() {
   // Views check_plain()s the column label, so we need to match that.
-  $select_all_placeholder = check_plain('<!--action-bulk-form-select-all-->');
+  $select_all_placeholder = String::checkPlain('<!--action-bulk-form-select-all-->');
   $select_all = array(
     '#type' => 'checkbox',
     '#default_value' => FALSE,
diff --git a/core/modules/aggregator/aggregator.theme.inc b/core/modules/aggregator/aggregator.theme.inc
index 5531dd6..07806e0 100644
--- a/core/modules/aggregator/aggregator.theme.inc
+++ b/core/modules/aggregator/aggregator.theme.inc
@@ -5,6 +5,7 @@
  * Preprocessors and theme functions of Aggregator module.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityInterface;
 
 /**
@@ -21,7 +22,7 @@ function template_preprocess_aggregator_item(&$variables) {
   $item = $variables['aggregator_item'];
 
   $variables['feed_url'] = check_url($item->getLink());
-  $variables['feed_title'] = check_plain($item->getTitle());
+  $variables['feed_title'] = String::checkPlain($item->getTitle());
   $variables['content'] = aggregator_filter_xss($item->getDescription());
 
   $variables['source_url'] = '';
@@ -29,7 +30,7 @@ function template_preprocess_aggregator_item(&$variables) {
   $fid = $item->getFeedId();
   if (isset($item->ftitle) && $fid !== NULL) {
     $variables['source_url'] = url('aggregator/sources/' . $fid);
-    $variables['source_title'] = check_plain($item->ftitle);
+    $variables['source_title'] = String::checkPlain($item->ftitle);
   }
   if (date('Ymd', $item->getPostedTime()) == date('Ymd')) {
     $variables['source_date'] = t('%ago ago', array('%ago' => format_interval(REQUEST_TIME - $item->getPostedTime())));
@@ -59,12 +60,12 @@ function theme_aggregator_page_opml($variables) {
   $output  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
   $output .= "<opml version=\"1.1\">\n";
   $output .= "<head>\n";
-  $output .= '<title>' . check_plain(\Drupal::config('system.site')->get('name')) . "</title>\n";
+  $output .= '<title>' . String::checkPlain(\Drupal::config('system.site')->get('name')) . "</title>\n";
   $output .= '<dateModified>' . gmdate(DATE_RFC2822, REQUEST_TIME) . "</dateModified>\n";
   $output .= "</head>\n";
   $output .= "<body>\n";
   foreach ($feeds as $feed) {
-    $output .= '<outline text="' . check_plain($feed->title) . '" xmlUrl="' . check_url($feed->url) . "\" />\n";
+    $output .= '<outline text="' . String::checkPlain($feed->title) . '" xmlUrl="' . check_url($feed->url) . "\" />\n";
   }
   $output .= "</body>\n";
   $output .= "</opml>\n";
@@ -84,7 +85,7 @@ function theme_aggregator_page_opml($variables) {
  *   - summary_items: An array of feed items.
  */
 function template_preprocess_aggregator_summary_items(&$variables) {
-  $variables['title'] = check_plain($variables['source'] instanceof EntityInterface ? $variables['source']->label() : $variables['source']->title);
+  $variables['title'] = String::checkPlain($variables['source'] instanceof EntityInterface ? $variables['source']->label() : $variables['source']->title);
   $summary_items = array();
   foreach (element_children($variables['summary_items']) as $key) {
     $summary_items[] = $variables['summary_items'][$key];
@@ -109,7 +110,7 @@ function template_preprocess_aggregator_summary_items(&$variables) {
 function template_preprocess_aggregator_summary_item(&$variables) {
   $item = $variables['aggregator_item'];
 
-  $variables['url'] = l(check_plain($item->label()), check_url(url($item->getLink(), array('absolute' => TRUE))), array(
+  $variables['url'] = l(String::checkPlain($item->label()), check_url(url($item->getLink(), array('absolute' => TRUE))), array(
     'attributes' => array(
       'class' => array('feed-item-url'),
     ),
@@ -186,5 +187,5 @@ function template_preprocess_aggregator_feed_source(&$variables) {
 function template_preprocess_aggregator_block_item(&$variables) {
   // Display the external link to the item.
   $variables['url'] = check_url($variables['item']->link);
-  $variables['title'] = check_plain($variables['item']->title);
+  $variables['title'] = String::checkPlain($variables['item']->title);
 }
diff --git a/core/modules/ban/lib/Drupal/ban/EventSubscriber/BanSubscriber.php b/core/modules/ban/lib/Drupal/ban/EventSubscriber/BanSubscriber.php
index 6807cce..af82055 100644
--- a/core/modules/ban/lib/Drupal/ban/EventSubscriber/BanSubscriber.php
+++ b/core/modules/ban/lib/Drupal/ban/EventSubscriber/BanSubscriber.php
@@ -7,12 +7,12 @@
 
 namespace Drupal\ban\EventSubscriber;
 
+use Drupal\Component\Utility\String;
+use Drupal\ban\BanIpManager;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpKernel\KernelEvents;
 use Symfony\Component\HttpKernel\Event\GetResponseEvent;
-use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-
-use Drupal\ban\BanIpManager;
+use Symfony\Component\HttpKernel\KernelEvents;
 
 /**
  * Ban subscriber for controller requests.
@@ -45,7 +45,7 @@ public function __construct(BanIpManager $manager) {
   public function onKernelRequestBannedIpCheck(GetResponseEvent $event) {
     $ip = $event->getRequest()->getClientIp();
     if ($this->manager->isDenied($ip)) {
-      $response = new Response('Sorry, ' . check_plain($ip) . ' has been banned.', 403);
+      $response = new Response('Sorry, ' . String::checkPlain($ip) . ' has been banned.', 403);
       $event->setResponse($response);
     }
   }
diff --git a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php
index 200b428..9f72afb 100644
--- a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php
+++ b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php
@@ -7,9 +7,10 @@
 
 namespace Drupal\block;
 
+use Drupal\Component\Utility\String;
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityViewBuilder;
 use Drupal\Core\Entity\EntityViewBuilderInterface;
-use Drupal\Core\Entity\EntityInterface;
 
 /**
  * Provides a Block view builder.
@@ -61,7 +62,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
           '#base_plugin_id' => $base_id,
           '#derivative_plugin_id' => $derivative_id,
         );
-        $build[$key]['#configuration']['label'] = check_plain($configuration['label']);
+        $build[$key]['#configuration']['label'] = String::checkPlain($configuration['label']);
 
         // Place the $content returned by the block plugin into a 'content'
         // child element, as a way to allow the plugin to have complete control
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index 8fe9e41..ddceaa5 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -5,12 +5,13 @@
  * Allows users to create and organize related content in an outline.
  */
 
+use Drupal\Component\Utility\String;
+use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
 use Drupal\Core\Entity\EntityInterface;
-use Drupal\node\NodeInterface;
-use Drupal\node\NodeTypeInterface;
 use Drupal\Core\Language\Language;
-use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
 use Drupal\Core\Template\Attribute;
+use Drupal\node\NodeInterface;
+use Drupal\node\NodeTypeInterface;
 
 /**
  * Implements hook_help().
@@ -661,7 +662,7 @@ function template_preprocess_book_navigation(&$variables) {
 
   // Provide extra variables for themers. Not needed by default.
   $variables['book_id'] = $book_link['bid'];
-  $variables['book_title'] = check_plain($book_link['link_title']);
+  $variables['book_title'] = String::checkPlain($book_link['link_title']);
   $variables['book_url'] = 'node/' . $book_link['bid'];
   $variables['current_depth'] = $book_link['depth'];
   $variables['tree'] = '';
@@ -678,7 +679,7 @@ function template_preprocess_book_navigation(&$variables) {
         'href' => $prev_href,
       );
       $variables['prev_url'] = $prev_href;
-      $variables['prev_title'] = check_plain($prev['title']);
+      $variables['prev_title'] = String::checkPlain($prev['title']);
     }
 
     if ($book_link['plid'] && $parent = book_link_load($book_link['plid'])) {
@@ -688,7 +689,7 @@ function template_preprocess_book_navigation(&$variables) {
         'href' => $parent_href,
       );
       $variables['parent_url'] = $parent_href;
-      $variables['parent_title'] = check_plain($parent['title']);
+      $variables['parent_title'] = String::checkPlain($parent['title']);
     }
 
     if ($next = book_next($book_link)) {
@@ -698,7 +699,7 @@ function template_preprocess_book_navigation(&$variables) {
         'href' => $next_href,
       );
       $variables['next_url'] = $next_href;
-      $variables['next_title'] = check_plain($next['title']);
+      $variables['next_title'] = String::checkPlain($next['title']);
     }
   }
 
@@ -736,7 +737,7 @@ function template_preprocess_book_export_html(&$variables) {
   global $base_url;
   $language_interface = language(Language::TYPE_INTERFACE);
 
-  $variables['title'] = check_plain($variables['title']);
+  $variables['title'] = String::checkPlain($variables['title']);
   $variables['base_url'] = $base_url;
   $variables['language'] = $language_interface;
   $variables['language_rtl'] = ($language_interface->direction == Language::DIRECTION_RTL);
@@ -762,7 +763,7 @@ function template_preprocess_book_export_html(&$variables) {
  */
 function template_preprocess_book_node_export_html(&$variables) {
   $variables['depth'] = $variables['node']->book['depth'];
-  $variables['title'] = check_plain($variables['node']->label());
+  $variables['title'] = String::checkPlain($variables['node']->label());
   $variables['content'] = $variables['node']->rendered;
 }
 
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index aaf0ba6..592b418 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\String;
 use Drupal\Core\Asset\CssOptimizer;
 
 /**
@@ -214,7 +215,7 @@ function color_scheme_form($complete_form, &$form_state, $theme) {
     if (isset($names[$name])) {
       $form['palette'][$name] = array(
         '#type' => 'textfield',
-        '#title' => check_plain($names[$name]),
+        '#title' => String::checkPlain($names[$name]),
         '#value_callback' => 'color_palette_color_value',
         '#default_value' => $value,
         '#size' => 8,
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index cb98f72..3e53f17 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -10,10 +10,11 @@
  * book page, user etc.
  */
 
-use Drupal\Core\Entity\EntityInterface;
+use Drupal\Component\Utility\String;
+use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
 use Drupal\Core\Entity\EntityChangedInterface;
+use Drupal\Core\Entity\EntityInterface;
 use Drupal\comment\CommentInterface;
-use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
 use Drupal\field\FieldInstanceInterface;
 use Drupal\field\FieldInterface;
 use Drupal\file\FileInterface;
@@ -1299,7 +1300,7 @@ function comment_preview(CommentInterface $comment, array &$form_state) {
 
     if (!empty($account) && $account->isAuthenticated()) {
       $comment->setOwner($account);
-      $comment->setAuthorName(check_plain($account->getUsername()));
+      $comment->setAuthorName(String::checkPlain($account->getUsername()));
     }
     elseif (empty($author_name)) {
       $comment->setAuthorName(\Drupal::config('user.settings')->get('anonymous'));
diff --git a/core/modules/comment/comment.tokens.inc b/core/modules/comment/comment.tokens.inc
index ecff337..bf5a3e2 100644
--- a/core/modules/comment/comment.tokens.inc
+++ b/core/modules/comment/comment.tokens.inc
@@ -5,6 +5,8 @@
  * Builds placeholder replacement tokens for comment-related data.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Implements hook_token_info().
  */
@@ -139,7 +141,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
 
         // Poster identity information for comments.
         case 'hostname':
-          $replacements[$original] = $sanitize ? check_plain($comment->getHostname()) : $comment->getHostname();
+          $replacements[$original] = $sanitize ? String::checkPlain($comment->getHostname()) : $comment->getHostname();
           break;
 
         case 'name':
@@ -149,7 +151,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
 
         case 'mail':
           $mail = $comment->getAuthorEmail();
-          $replacements[$original] = $sanitize ? check_plain($mail) : $mail;
+          $replacements[$original] = $sanitize ? String::checkPlain($mail) : $mail;
           break;
 
         case 'homepage':
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php
index 7f58b18..4534076 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\comment\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Database\Connection;
 use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -64,7 +65,7 @@ function title() {
       return t('No user');
     }
 
-    return check_plain($title);
+    return String::checkPlain($title);
   }
 
   protected function defaultActions($which = NULL) {
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
index 081775f..3134406 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\comment\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Language\Language;
 
 /**
@@ -53,10 +54,10 @@ function testCommentTokenReplacement() {
     // Generate and test sanitized tokens.
     $tests = array();
     $tests['[comment:cid]'] = $comment->id();
-    $tests['[comment:hostname]'] = check_plain($comment->getHostname());
+    $tests['[comment:hostname]'] = String::checkPlain($comment->getHostname());
     $tests['[comment:name]'] = filter_xss($comment->getAuthorName());
     $tests['[comment:author]'] = filter_xss($comment->getAuthorName());
-    $tests['[comment:mail]'] = check_plain($this->admin_user->getEmail());
+    $tests['[comment:mail]'] = String::checkPlain($this->admin_user->getEmail());
     $tests['[comment:homepage]'] = check_url($comment->getHomepage());
     $tests['[comment:title]'] = filter_xss($comment->getSubject());
     $tests['[comment:body]'] = $comment->comment_body->processed;
@@ -65,11 +66,11 @@ function testCommentTokenReplacement() {
     $tests['[comment:created:since]'] = format_interval(REQUEST_TIME - $comment->getCreatedTime(), 2, $language_interface->id);
     $tests['[comment:changed:since]'] = format_interval(REQUEST_TIME - $comment->getChangedTime(), 2, $language_interface->id);
     $tests['[comment:parent:cid]'] = $comment->hasParentComment() ? $comment->getParentComment()->id() : NULL;
-    $tests['[comment:parent:title]'] = check_plain($parent_comment->getSubject());
+    $tests['[comment:parent:title]'] = String::checkPlain($parent_comment->getSubject());
     $tests['[comment:node:nid]'] = $comment->getCommentedEntityId();
-    $tests['[comment:node:title]'] = check_plain($node->getTitle());
+    $tests['[comment:node:title]'] = String::checkPlain($node->getTitle());
     $tests['[comment:author:uid]'] = $comment->getOwnerId();
-    $tests['[comment:author:name]'] = check_plain($this->admin_user->getUsername());
+    $tests['[comment:author:name]'] = String::checkPlain($this->admin_user->getUsername());
 
     // Test to make sure that we generated something for each token.
     $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
index e7012b6..953ecaa 100644
--- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php
+++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\contact;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\ContentEntityFormController;
 use Drupal\Core\Language\Language;
 use Drupal\user\UserInterface;
@@ -61,12 +62,12 @@ public function form(array $form, array &$form_state) {
       $form['name']['#type'] = 'item';
       $form['name']['#value'] = $user->getUsername();
       $form['name']['#required'] = FALSE;
-      $form['name']['#markup'] = check_plain($user->getUsername());
+      $form['name']['#markup'] = String::checkPlain($user->getUsername());
 
       $form['mail']['#type'] = 'item';
       $form['mail']['#value'] = $user->getEmail();
       $form['mail']['#required'] = FALSE;
-      $form['mail']['#markup'] = check_plain($user->getEmail());
+      $form['mail']['#markup'] = String::checkPlain($user->getEmail());
     }
 
     // The user contact form has a preset recipient.
diff --git a/core/modules/contact/lib/Drupal/contact/MessageViewBuilder.php b/core/modules/contact/lib/Drupal/contact/MessageViewBuilder.php
index 4feeb4f..aa38a35 100644
--- a/core/modules/contact/lib/Drupal/contact/MessageViewBuilder.php
+++ b/core/modules/contact/lib/Drupal/contact/MessageViewBuilder.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\contact;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityViewBuilder;
 
@@ -28,7 +29,7 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang
         $entity->content['message'] = array(
           '#type' => 'item',
           '#title' => t('Message'),
-          '#markup' => check_plain($entity->getMessage()),
+          '#markup' => String::checkPlain($entity->getMessage()),
         );
       }
     }
diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc
index a8a88ed..13c81eb 100644
--- a/core/modules/content_translation/content_translation.admin.inc
+++ b/core/modules/content_translation/content_translation.admin.inc
@@ -5,6 +5,7 @@
  * The content translation administration forms.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Language\Language;
@@ -194,10 +195,10 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
               'bundle' => array(
                 '#prefix' => '<span class="visually-hidden">',
                 '#suffix' => '</span> ',
-                '#markup' => check_plain($element[$bundle]['settings']['#label']),
+                '#markup' => String::checkPlain($element[$bundle]['settings']['#label']),
               ),
               'field' => array(
-                '#markup' => check_plain($field_element['#label']),
+                '#markup' => String::checkPlain($field_element['#label']),
               ),
             ),
             'class' => array('field'),
@@ -228,15 +229,15 @@ function _content_translation_preprocess_language_content_settings_table(&$varia
                   'bundle' => array(
                     '#prefix' => '<span class="visually-hidden">',
                     '#suffix' => '</span> ',
-                    '#markup' => check_plain($element[$bundle]['settings']['#label']),
+                    '#markup' => String::checkPlain($element[$bundle]['settings']['#label']),
                   ),
                   'field' => array(
                     '#prefix' => '<span class="visually-hidden">',
                     '#suffix' => '</span> ',
-                    '#markup' => check_plain($field_element['#label']),
+                    '#markup' => String::checkPlain($field_element['#label']),
                   ),
                   'columns' => array(
-                    '#markup' => check_plain($column_label),
+                    '#markup' => String::checkPlain($column_label),
                   ),
                 ),
                 'class' => array('column'),
diff --git a/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php b/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php
index 2fd63ed..89ae1d9 100644
--- a/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php
+++ b/core/modules/edit/lib/Drupal/edit/MetadataGenerator.php
@@ -8,6 +8,7 @@
 namespace Drupal\edit;
 
 use Drupal\Component\Plugin\PluginManagerInterface;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\edit\Access\EditEntityFieldAccessCheckInterface;
@@ -88,7 +89,7 @@ public function generateFieldMetadata(FieldItemListInterface $items, $view_mode)
     $label = $items->getFieldDefinition()->getLabel();
     $editor = $this->editorManager->createInstance($editor_id);
     $metadata = array(
-      'label' => check_plain($label),
+      'label' => String::checkPlain($label),
       'access' => TRUE,
       'editor' => $editor_id,
       'aria' => t('Entity @type @id, field @field', array('@type' => $entity->getEntityTypeId(), '@id' => $entity->id(), '@field' => $label)),
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php
index f2eb699..c9b463e 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/ConfigurableEntityReferenceItem.php
@@ -8,6 +8,7 @@
 namespace Drupal\entity_reference;
 
 use Drupal\Component\Utility\String;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\ConfigFieldItemInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem;
@@ -184,7 +185,7 @@ public function instanceSettingsForm(array $form, array &$form_state) {
       // entity type specific plugins (e.g. 'default_node', 'default_user',
       // ...).
       if (in_array($plugin_id, $handler_groups)) {
-        $handlers_options[$plugin_id] = check_plain($plugin['label']);
+        $handlers_options[$plugin_id] = String::checkPlain($plugin['label']);
       }
     }
 
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php
index 6df0d11..41a8995 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\entity_reference\Plugin\Field\FieldFormatter;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldItemListInterface;
 
 /**
@@ -35,7 +36,7 @@ public function viewElements(FieldItemListInterface $items) {
         continue;
       }
       if (!empty($item->entity) && !empty($item->target_id)) {
-        $elements[$delta] = array('#markup' => check_plain($item->target_id));
+        $elements[$delta] = array('#markup' => String::checkPlain($item->target_id));
       }
     }
 
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
index ea13e17..7b0b0ef 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\entity_reference\Plugin\Field\FieldFormatter;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldItemListInterface;
 
 /**
@@ -74,7 +75,7 @@ public function viewElements(FieldItemListInterface $items) {
           );
         }
         else {
-          $elements[$delta] = array('#markup' => check_plain($label));
+          $elements[$delta] = array('#markup' => String::checkPlain($label));
         }
       }
     }
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
index f7b74e4..97b5973 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
@@ -7,11 +7,12 @@
 
 namespace Drupal\entity_reference\Plugin\entity_reference\selection;
 
+use Drupal\Component\Utility\NestedArray;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Database\Query\AlterableInterface;
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
-use Drupal\Component\Utility\NestedArray;
 use Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface;
 
 /**
@@ -174,7 +175,7 @@ public function getReferenceableEntities($match = NULL, $match_operator = 'CONTA
     $entities = entity_load_multiple($target_type, $result);
     foreach ($entities as $entity_id => $entity) {
       $bundle = $entity->bundle();
-      $options[$bundle][$entity_id] = check_plain($entity->label());
+      $options[$bundle][$entity_id] = String::checkPlain($entity->label());
     }
 
     return $options;
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutocompleteTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutocompleteTest.php
index 987919d..5b78296 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutocompleteTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutocompleteTest.php
@@ -7,10 +7,10 @@
 
 namespace Drupal\entity_reference\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Tags;
 use Drupal\entity_reference\EntityReferenceController;
 use Drupal\system\Tests\Entity\EntityUnitTestBase;
-
 use Symfony\Component\HttpFoundation\Request;
 
 /**
@@ -80,8 +80,8 @@ function testEntityReferenceAutocompletion() {
     // We should get both entities in a JSON encoded string.
     $input = '10/';
     $data = $this->getAutocompleteResult('single', $input);
-    $this->assertIdentical($data[0]['label'], check_plain($entity_1->name->value), 'Autocomplete returned the first matching entity');
-    $this->assertIdentical($data[1]['label'], check_plain($entity_2->name->value), 'Autocomplete returned the second matching entity');
+    $this->assertIdentical($data[0]['label'], String::checkPlain($entity_1->name->value), 'Autocomplete returned the first matching entity');
+    $this->assertIdentical($data[1]['label'], String::checkPlain($entity_2->name->value), 'Autocomplete returned the second matching entity');
 
     // Try to autocomplete a entity label that matches the first entity.
     // We should only get the first entity in a JSON encoded string.
@@ -89,7 +89,7 @@ function testEntityReferenceAutocompletion() {
     $data = $this->getAutocompleteResult('single', $input);
     $target = array(
       'value' => $entity_1->name->value . ' (1)',
-      'label' => check_plain($entity_1->name->value),
+      'label' => String::checkPlain($entity_1->name->value),
     );
     $this->assertIdentical(reset($data), $target, 'Autocomplete returns only the expected matching entity.');
 
@@ -97,7 +97,7 @@ function testEntityReferenceAutocompletion() {
     // the first entity  is already typed in the autocomplete (tags) widget.
     $input = $entity_1->name->value . ' (1), 10/17';
     $data = $this->getAutocompleteResult('tags', $input);
-    $this->assertIdentical($data[0]['label'], check_plain($entity_2->name->value), 'Autocomplete returned the second matching entity');
+    $this->assertIdentical($data[0]['label'], String::checkPlain($entity_2->name->value), 'Autocomplete returned the second matching entity');
 
     // Try to autocomplete a entity label with both a comma and a slash.
     $input = '"label with, and / t';
@@ -107,7 +107,7 @@ function testEntityReferenceAutocompletion() {
     $n = Tags::encode($n);
     $target = array(
       'value' => $n,
-      'label' => check_plain($entity_3->name->value),
+      'label' => String::checkPlain($entity_3->name->value),
     );
     $this->assertIdentical(reset($data), $target, 'Autocomplete returns an entity label containing a comma and a slash.');
   }
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
index 3fb6460..93b825c 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\entity_reference\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Language\Language;
 use Drupal\comment\CommentInterface;
@@ -115,7 +116,7 @@ public function testNodeHandler() {
       $node = entity_create('node', $values);
       $node->save();
       $nodes[$key] = $node;
-      $node_labels[$key] = check_plain($node->label());
+      $node_labels[$key] = String::checkPlain($node->label());
     }
 
     // Test as a non-admin.
@@ -262,7 +263,7 @@ public function testUserHandler() {
         $account = $values;
       }
       $users[$key] = $account;
-      $user_labels[$key] = check_plain($account->getUsername());
+      $user_labels[$key] = String::checkPlain($account->getUsername());
     }
 
     // Test as a non-admin.
@@ -442,7 +443,7 @@ public function testCommentHandler() {
       $comment = entity_create('comment', $values);
       $comment->save();
       $comments[$key] = $comment;
-      $comment_labels[$key] = check_plain($comment->label());
+      $comment_labels[$key] = String::checkPlain($comment->label());
     }
 
     // Test as a non-admin.
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php
index a93300e..e83b28f 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\entity_reference\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -115,7 +116,7 @@ public function testSort() {
       $node = entity_create('node', $values);
       $node->save();
       $nodes[$key] = $node;
-      $node_labels[$key] = check_plain($node->label());
+      $node_labels[$key] = String::checkPlain($node->label());
     }
 
     // Test as a non-admin.
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 2dd3469..ca71ad2 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -5,6 +5,7 @@
  */
 
 use Drupal\Component\Utility\Html;
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Xss;
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Template\Attribute;
@@ -502,7 +503,7 @@ function template_preprocess_field(&$variables, $hook) {
   // label, it needs to supply a preprocess function that sets it to the
   // sanitized element title or whatever else is wanted in its place.
   $variables['label_hidden'] = ($element['#label_display'] == 'hidden');
-  $variables['label'] = check_plain($element['#title']);
+  $variables['label'] = String::checkPlain($element['#title']);
 
   // We want other preprocess functions and the theme implementation to have
   // fast access to the field item render arrays. The item render array keys
diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php b/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php
index d29319d..4b780f6 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/views/argument/FieldList.php
@@ -7,9 +7,10 @@
 
 namespace Drupal\field\Plugin\views\argument;
 
-use Drupal\views\ViewExecutable;
-use Drupal\views\Plugin\views\display\DisplayPluginBase;
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\Numeric;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
+use Drupal\views\ViewExecutable;
 
 /**
  * Argument handler for list field to show the human readable name in the
@@ -68,7 +69,7 @@ public function summaryName($data) {
     }
     // else fallback to the key.
     else {
-      return check_plain($value);
+      return String::checkPlain($value);
     }
   }
 
diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php b/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php
index cc43140..76b5a7d 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/views/argument/ListString.php
@@ -7,9 +7,10 @@
 
 namespace Drupal\field\Plugin\views\argument;
 
-use Drupal\views\ViewExecutable;
-use Drupal\views\Plugin\views\display\DisplayPluginBase;
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\String;
+use Drupal\views\Plugin\views\display\DisplayPluginBase;
+use Drupal\views\ViewExecutable;
 
 /**
  * Argument handler for list field to show the human readable name in the
@@ -70,7 +71,7 @@ public function summaryName($data) {
     }
     // else fallback to the key.
     else {
-      return $this->caseTransform(check_plain($value), $this->options['case']);
+      return $this->caseTransform(String::checkPlain($value), $this->options['case']);
     }
   }
 
diff --git a/core/modules/field/lib/Drupal/field/Tests/FormTest.php b/core/modules/field/lib/Drupal/field/Tests/FormTest.php
index 81ec2ff..46fc515 100644
--- a/core/modules/field/lib/Drupal/field/Tests/FormTest.php
+++ b/core/modules/field/lib/Drupal/field/Tests/FormTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\field\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldDefinitionInterface;
 
 class FormTest extends FieldTestBase {
@@ -104,7 +105,7 @@ function testFieldFormSingle() {
     $this->drupalGet('entity_test/add');
 
     // Create token value expected for description.
-    $token_description = check_plain(\Drupal::config('system.site')->get('name')) . '_description';
+    $token_description = String::checkPlain(\Drupal::config('system.site')->get('name')) . '_description';
     $this->assertText($token_description, 'Token replacement for description is displayed');
     $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed');
     $this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed');
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php
index 2ed54e8..2b6ed40 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php
@@ -8,6 +8,7 @@
 namespace Drupal\field_ui;
 
 use Drupal\Component\Plugin\PluginManagerBase;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\Display\EntityDisplayInterface;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
@@ -268,7 +269,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent
         'defaultPlugin' => $this->getDefaultPlugin($field_definition->getType()),
       ),
       'human_name' => array(
-        '#markup' => check_plain($label),
+        '#markup' => String::checkPlain($label),
       ),
       'weight' => array(
         '#type' => 'textfield',
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
index e281f0e..d1ccbed 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
@@ -7,12 +7,13 @@
 
 namespace Drupal\field_ui;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Field\FieldTypePluginManagerInterface;
+use Drupal\field\Entity\Field;
 use Drupal\field_ui\OverviewBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\field\Entity\Field;
 
 /**
  * Field UI field overview form.
@@ -131,7 +132,7 @@ public function buildForm(array $form, array &$form_state, $entity_type_id = NUL
           'id' => drupal_html_class($name),
         ),
         'label' => array(
-          '#markup' => check_plain($instance->getLabel()),
+          '#markup' => String::checkPlain($instance->getLabel()),
         ),
         'field_name' => array(
           '#markup' => $instance->getName(),
diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc
index 8a64332..0ea3c8e 100644
--- a/core/modules/file/file.field.inc
+++ b/core/modules/file/file.field.inc
@@ -6,6 +6,7 @@
  */
 
 use Drupal\Component\Utility\Html;
+use Drupal\Component\Utility\String;
 use Drupal\field\FieldInterface;
 
 /**
@@ -197,7 +198,7 @@ function theme_file_upload_help($variables) {
     $descriptions[] = t('!size limit.', array('!size' => format_size($upload_validators['file_validate_size'][0])));
   }
   if (isset($upload_validators['file_validate_extensions'])) {
-    $descriptions[] = t('Allowed types: !extensions.', array('!extensions' => check_plain($upload_validators['file_validate_extensions'][0])));
+    $descriptions[] = t('Allowed types: !extensions.', array('!extensions' => String::checkPlain($upload_validators['file_validate_extensions'][0])));
   }
 
   if (isset($upload_validators['file_validate_image_resolution'])) {
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index b359976..1e2e884 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -5,11 +5,12 @@
  * Defines a "managed_file" Form API field and a "file" field for Field module.
  */
 
-use Drupal\file\Entity\File;
 use Drupal\Component\Utility\NestedArray;
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Entity\EntityStorageControllerInterface;
 use Drupal\Core\Template\Attribute;
+use Drupal\file\Entity\File;
 use Drupal\file\FileUsage\FileUsageInterface;
 
 // Load all Field module hooks for File.
@@ -1018,15 +1019,15 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr
 
         // Essential file data
         case 'name':
-          $replacements[$original] = $sanitize ? check_plain($file->getFilename()) : $file->getFilename();
+          $replacements[$original] = $sanitize ? String::checkPlain($file->getFilename()) : $file->getFilename();
           break;
 
         case 'path':
-          $replacements[$original] = $sanitize ? check_plain($file->getFileUri()) : $file->getFileUri();
+          $replacements[$original] = $sanitize ? String::checkPlain($file->getFileUri()) : $file->getFileUri();
           break;
 
         case 'mime':
-          $replacements[$original] = $sanitize ? check_plain($file->getMimeType()) : $file->getMimeType();
+          $replacements[$original] = $sanitize ? String::checkPlain($file->getMimeType()) : $file->getMimeType();
           break;
 
         case 'size':
@@ -1034,7 +1035,7 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr
           break;
 
         case 'url':
-          $replacements[$original] = $sanitize ? check_plain(file_create_url($file->getFileUri())) : file_create_url($file->getFileUri());
+          $replacements[$original] = $sanitize ? String::checkPlain(file_create_url($file->getFileUri())) : file_create_url($file->getFileUri());
           break;
 
         // These tokens are default variations on the chained tokens handled below.
@@ -1048,7 +1049,7 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr
 
         case 'owner':
           $name = $file->getOwner()->label();
-          $replacements[$original] = $sanitize ? check_plain($name) : $name;
+          $replacements[$original] = $sanitize ? String::checkPlain($name) : $name;
           break;
       }
     }
@@ -1596,7 +1597,7 @@ function theme_file_link($variables) {
   }
   else {
     $link_text = $variables['description'];
-    $options['attributes']['title'] = check_plain($file->getFilename());
+    $options['attributes']['title'] = String::checkPlain($file->getFilename());
   }
 
   $file_icon = array(
@@ -1624,7 +1625,7 @@ function theme_file_icon($variables) {
   $file = $variables['file'];
   $icon_directory = $variables['icon_directory'];
 
-  $mime = check_plain($file->getMimeType());
+  $mime = String::checkPlain($file->getMimeType());
   $icon_url = file_icon_url($file, $icon_directory);
   return '<img class="file-icon" alt="" title="' . $mime . '" src="' . $icon_url . '" />';
 }
diff --git a/core/modules/file/lib/Drupal/file/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/lib/Drupal/file/Plugin/Field/FieldWidget/FileWidget.php
index 5c976ed..51178d4 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/Field/FieldWidget/FileWidget.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/Field/FieldWidget/FileWidget.php
@@ -7,10 +7,11 @@
 
 namespace Drupal\file\Plugin\Field\FieldWidget;
 
+use Drupal\Component\Utility\NestedArray;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldDefinitionInterface;
-use Drupal\Core\Field\WidgetBase;
 use Drupal\Core\Field\FieldItemListInterface;
-use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Field\WidgetBase;
 use Drupal\field\Field;
 
 /**
@@ -88,7 +89,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f
         break;
     }
 
-    $title = check_plain($this->fieldDefinition->getLabel());
+    $title = String::checkPlain($this->fieldDefinition->getLabel());
     $description = field_filter_xss($this->fieldDefinition->getDescription());
 
     $elements = array();
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
index 03aedcb..b8c7784 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\file\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Language\Language;
 
 /**
@@ -48,16 +49,16 @@ function testFileTokenReplacement() {
     // Generate and test sanitized tokens.
     $tests = array();
     $tests['[file:fid]'] = $file->id();
-    $tests['[file:name]'] = check_plain($file->getFilename());
-    $tests['[file:path]'] = check_plain($file->getFileUri());
-    $tests['[file:mime]'] = check_plain($file->getMimeType());
+    $tests['[file:name]'] = String::checkPlain($file->getFilename());
+    $tests['[file:path]'] = String::checkPlain($file->getFileUri());
+    $tests['[file:mime]'] = String::checkPlain($file->getMimeType());
     $tests['[file:size]'] = format_size($file->getSize());
-    $tests['[file:url]'] = check_plain(file_create_url($file->getFileUri()));
+    $tests['[file:url]'] = String::checkPlain(file_create_url($file->getFileUri()));
     $tests['[file:created]'] = format_date($file->getCreatedTime(), 'medium', '', NULL, $language_interface->id);
     $tests['[file:created:short]'] = format_date($file->getCreatedTime(), 'short', '', NULL, $language_interface->id);
     $tests['[file:changed]'] = format_date($file->getChangedTime(), 'medium', '', NULL, $language_interface->id);
     $tests['[file:changed:short]'] = format_date($file->getChangedTime(), 'short', '', NULL, $language_interface->id);
-    $tests['[file:owner]'] = check_plain(user_format_name($this->admin_user));
+    $tests['[file:owner]'] = String::checkPlain(user_format_name($this->admin_user));
     $tests['[file:owner:uid]'] = $file->getOwnerId();
 
     // Test to make sure that we generated something for each token.
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index e9c04d4..9f12a0d 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -7,6 +7,7 @@
 
 use Drupal\Component\Utility\Html;
 use Drupal\Component\Utility\String;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Session\AccountInterface;
@@ -939,8 +940,8 @@ function _filter_url_parse_full_links($match) {
   $i = 1;
 
   $match[$i] = decode_entities($match[$i]);
-  $caption = check_plain(_filter_url_trim($match[$i]));
-  $match[$i] = check_plain($match[$i]);
+  $caption = String::checkPlain(_filter_url_trim($match[$i]));
+  $match[$i] = String::checkPlain($match[$i]);
   return '<a href="' . $match[$i] . '">' . $caption . '</a>';
 }
 
@@ -954,8 +955,8 @@ function _filter_url_parse_email_links($match) {
   $i = 0;
 
   $match[$i] = decode_entities($match[$i]);
-  $caption = check_plain(_filter_url_trim($match[$i]));
-  $match[$i] = check_plain($match[$i]);
+  $caption = String::checkPlain(_filter_url_trim($match[$i]));
+  $match[$i] = String::checkPlain($match[$i]);
   return '<a href="mailto:' . $match[$i] . '">' . $caption . '</a>';
 }
 
@@ -969,8 +970,8 @@ function _filter_url_parse_partial_links($match) {
   $i = 1;
 
   $match[$i] = decode_entities($match[$i]);
-  $caption = check_plain(_filter_url_trim($match[$i]));
-  $match[$i] = check_plain($match[$i]);
+  $caption = String::checkPlain(_filter_url_trim($match[$i]));
+  $match[$i] = String::checkPlain($match[$i]);
   return '<a href="http://' . $match[$i] . '">' . $caption . '</a>';
 }
 
@@ -1102,7 +1103,7 @@ function _filter_autop($text) {
  * Escapes all HTML tags, so they will be visible instead of being effective.
  */
 function _filter_html_escape($text) {
-  return trim(check_plain($text));
+  return trim(String::checkPlain($text));
 }
 
 /**
diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php
index a49f5f4..f0a7ec8 100644
--- a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php
+++ b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\filter\Plugin\Filter;
 
+use Drupal\Component\Utility\String;
 use Drupal\filter\Plugin\FilterBase;
 
 /**
@@ -99,7 +100,7 @@ public function tips($long = FALSE) {
     $output .= '<p>' . t('This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.') . '</p>';
     $output .= '<p>' . t('For more information see W3C\'s <a href="@html-specifications">HTML Specifications</a> or use your favorite search engine to find other sites that explain HTML.', array('@html-specifications' => 'http://www.w3.org/TR/html/')) . '</p>';
     $tips = array(
-      'a' => array(t('Anchors are used to make links to other pages.'), '<a href="' . $base_url . '">' . check_plain(\Drupal::config('system.site')->get('name')) . '</a>'),
+      'a' => array(t('Anchors are used to make links to other pages.'), '<a href="' . $base_url . '">' . String::checkPlain(\Drupal::config('system.site')->get('name')) . '</a>'),
       'br' => array(t('By default line break tags are automatically added, so use this tag to add additional ones. Use of this tag is different because it is not used with an open/close pair like all the others. Use the extra " /" inside the tag to maintain XHTML 1.0 compatibility'), t('Text with <br />line break')),
       'p' => array(t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '<p>' . t('Paragraph one.') . '</p> <p>' . t('Paragraph two.') . '</p>'),
       'strong' => array(t('Strong', array(), array('context' => 'Font weight')), '<strong>' . t('Strong', array(), array('context' => 'Font weight')) . '</strong>'),
@@ -141,7 +142,7 @@ public function tips($long = FALSE) {
       if (!empty($tips[$tag])) {
         $rows[] = array(
           array('data' => $tips[$tag][0], 'class' => array('description')),
-          array('data' => '<code>' . check_plain($tips[$tag][1]) . '</code>', 'class' => array('type')),
+          array('data' => '<code>' . String::checkPlain($tips[$tag][1]) . '</code>', 'class' => array('type')),
           array('data' => $tips[$tag][1], 'class' => array('get'))
         );
       }
@@ -172,7 +173,7 @@ public function tips($long = FALSE) {
     foreach ($entities as $entity) {
       $rows[] = array(
         array('data' => $entity[0], 'class' => array('description')),
-        array('data' => '<code>' . check_plain($entity[1]) . '</code>', 'class' => array('type')),
+        array('data' => '<code>' . String::checkPlain($entity[1]) . '</code>', 'class' => array('type')),
         array('data' => $entity[1], 'class' => array('get'))
       );
     }
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php
index e10c5ca..8d13d86 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\filter\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -254,7 +255,7 @@ function testFilterAdmin() {
     $edit['body[0][format]'] = $plain;
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
     $this->drupalGet('node/' . $node->id());
-    $this->assertText(check_plain($text), 'The "Plain text" text format escapes all HTML tags.');
+    $this->assertText(String::checkPlain($text), 'The "Plain text" text format escapes all HTML tags.');
     \Drupal::config('filter.settings')
       ->set('always_show_fallback_choice', FALSE)
       ->save();
diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php
index a51d6b9..ee92929 100644
--- a/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php
+++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php
@@ -8,8 +8,9 @@
 namespace Drupal\filter\Tests;
 
 use Drupal\Component\Utility\Html;
-use Drupal\simpletest\DrupalUnitTestBase;
+use Drupal\Component\Utility\String;
 use Drupal\filter\FilterBag;
+use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
  * Unit tests for core filters.
@@ -692,10 +693,10 @@ function assertFilteredString($filter, $tests) {
           )));
         }
         if (!$success) {
-          $this->verbose('Source:<pre>' . check_plain(var_export($source, TRUE)) . '</pre>'
-            . '<hr />' . 'Result:<pre>' . check_plain(var_export($result, TRUE)) . '</pre>'
+          $this->verbose('Source:<pre>' . String::checkPlain(var_export($source, TRUE)) . '</pre>'
+            . '<hr />' . 'Result:<pre>' . String::checkPlain(var_export($result, TRUE)) . '</pre>'
             . '<hr />' . ($is_expected ? 'Expected:' : 'Not expected:')
-            . '<pre>' . check_plain(var_export($value, TRUE)) . '</pre>'
+            . '<pre>' . String::checkPlain(var_export($value, TRUE)) . '</pre>'
           );
         }
       }
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 18e4149..d56b82a 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -5,6 +5,7 @@
  * Provides discussion forums.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\field\Field;
 
@@ -686,7 +687,7 @@ function template_preprocess_forums(&$variables) {
         // them is a shadow copy.
         if ($variables['tid'] != $topic->forum_tid) {
           $variables['topics'][$id]->moved = TRUE;
-          $variables['topics'][$id]->title = check_plain($topic->getTitle());
+          $variables['topics'][$id]->title = String::checkPlain($topic->getTitle());
           $variables['topics'][$id]->message = l(t('This topic has been moved'), "forum/$topic->forum_tid");
         }
         else {
@@ -778,7 +779,7 @@ function template_preprocess_forum_list(&$variables) {
   foreach ($variables['forums'] as $id => $forum) {
     $variables['forums'][$id]->description = filter_xss_admin($forum->description->value);
     $variables['forums'][$id]->link = url("forum/" . $forum->id());
-    $variables['forums'][$id]->name = check_plain($forum->label());
+    $variables['forums'][$id]->name = String::checkPlain($forum->label());
     $variables['forums'][$id]->is_container = !empty($forum->forum_container->value);
     $variables['forums'][$id]->zebra = $row % 2 == 0 ? 'odd' : 'even';
     $row++;
diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc
index 9675e98..571eefd 100644
--- a/core/modules/image/image.admin.inc
+++ b/core/modules/image/image.admin.inc
@@ -5,6 +5,8 @@
  * Administration pages for image settings.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Returns HTML for a listing of the effects within a specific image style.
  *
@@ -154,7 +156,7 @@ function theme_image_style_preview($variables) {
     '#attributes' => $preview_image,
   );
   $output .= '<div class="preview-image-wrapper">';
-  $output .= check_plain($style->label()) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')';
+  $output .= String::checkPlain($style->label()) . ' (' . l(t('view actual size'), file_create_url($preview_file) . '?' . time()) . ')';
   $output .= '<div class="preview-image modified-image" style="' . $preview_image['style'] . '">';
   $output .= '<a href="' . file_create_url($preview_file) . '?' . time() . '">' . drupal_render($image) . '</a>';
   $output .= '<div class="height" style="height: ' . $preview_height . 'px"><span>' . $preview_image['height'] . 'px</span></div>';
@@ -213,7 +215,7 @@ function theme_image_resize_summary($variables) {
   $data = $variables['data'];
 
   if ($data['width'] && $data['height']) {
-    return check_plain($data['width']) . 'x' . check_plain($data['height']);
+    return String::checkPlain($data['width']) . 'x' . String::checkPlain($data['height']);
   }
   else {
     return ($data['width']) ? t('width @width', array('@width' => $data['width'])) : t('height @height', array('@height' => $data['height']));
diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc
index 3bd73f9..74e5914 100644
--- a/core/modules/language/language.admin.inc
+++ b/core/modules/language/language.admin.inc
@@ -5,6 +5,7 @@
  * Administration functions for language.module.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Language\LanguageManager;
 
 /**
@@ -273,7 +274,7 @@ function template_preprocess_language_content_settings_table(&$variables) {
           'data' => array(
             '#prefix' => '<label>',
             '#suffix' => '</label>',
-            '#markup' => check_plain($element[$bundle]['settings']['#label']),
+            '#markup' => String::checkPlain($element[$bundle]['settings']['#label']),
           ),
           'class' => array('bundle'),
         ),
diff --git a/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php b/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php
index b2adf0a..33d5fa1 100644
--- a/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php
+++ b/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\language\Form;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityFormController;
 use Drupal\Core\Language\Language;
 
@@ -72,7 +73,7 @@ public function validateCommon(array $form, array &$form_state) {
     if (!isset($form['langcode_view']) && preg_match('@[^a-zA-Z_-]@', $form_state['values']['langcode'])) {
       $this->setFormError('langcode', $form_state, $this->t('%field may only contain characters a-z, underscores, or hyphens.', array('%field' => $form['langcode']['#title'])));
     }
-    if ($form_state['values']['name'] != check_plain($form_state['values']['name'])) {
+    if ($form_state['values']['name'] != String::checkPlain($form_state['values']['name'])) {
       $this->setFormError('name', $form_state, $this->t('%field cannot contain any markup.', array('%field' => $form['name']['#title'])));
     }
   }
diff --git a/core/modules/link/lib/Drupal/link/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/link/lib/Drupal/link/Plugin/Field/FieldFormatter/LinkFormatter.php
index 111ce34..9d3f81c 100644
--- a/core/modules/link/lib/Drupal/link/Plugin/Field/FieldFormatter/LinkFormatter.php
+++ b/core/modules/link/lib/Drupal/link/Plugin/Field/FieldFormatter/LinkFormatter.php
@@ -7,9 +7,10 @@
 
 namespace Drupal\link\Plugin\Field\FieldFormatter;
 
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Url;
-use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Field\FieldItemInterface;
+use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Field\FormatterBase;
 
 /**
@@ -137,7 +138,7 @@ public function viewElements(FieldItemListInterface $items) {
 
       if (!empty($settings['url_only']) && !empty($settings['url_plain'])) {
         $element[$delta] = array(
-          '#markup' => check_plain($link_title),
+          '#markup' => String::checkPlain($link_title),
         );
       }
       else {
diff --git a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
index fa86ecb..d67d806 100644
--- a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
+++ b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\link\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -347,41 +348,41 @@ function testLinkFormatter() {
           case 'trim_length':
             $url = $url1;
             $title = isset($new_value) ? truncate_utf8($title1, $new_value, FALSE, TRUE) : $title1;
-            $this->assertRaw('<a href="' . check_plain($url) . '">' . check_plain($title) . '</a>');
+            $this->assertRaw('<a href="' . String::checkPlain($url) . '">' . String::checkPlain($title) . '</a>');
 
             $url = $url2;
             $title = isset($new_value) ? truncate_utf8($title2, $new_value, FALSE, TRUE) : $title2;
-            $this->assertRaw('<a href="' . check_plain($url) . '">' . check_plain($title) . '</a>');
+            $this->assertRaw('<a href="' . String::checkPlain($url) . '">' . String::checkPlain($title) . '</a>');
             break;
 
           case 'rel':
             $rel = isset($new_value) ? ' rel="' . $new_value . '"' : '';
-            $this->assertRaw('<a href="' . check_plain($url1) . '"' . $rel . '>' . check_plain($title1) . '</a>');
-            $this->assertRaw('<a href="' . check_plain($url2) . '"' . $rel . '>' . check_plain($title2) . '</a>');
+            $this->assertRaw('<a href="' . String::checkPlain($url1) . '"' . $rel . '>' . String::checkPlain($title1) . '</a>');
+            $this->assertRaw('<a href="' . String::checkPlain($url2) . '"' . $rel . '>' . String::checkPlain($title2) . '</a>');
             break;
 
           case 'target':
             $target = isset($new_value) ? ' target="' . $new_value . '"' : '';
-            $this->assertRaw('<a href="' . check_plain($url1) . '"' . $target . '>' . check_plain($title1) . '</a>');
-            $this->assertRaw('<a href="' . check_plain($url2) . '"' . $target . '>' . check_plain($title2) . '</a>');
+            $this->assertRaw('<a href="' . String::checkPlain($url1) . '"' . $target . '>' . String::checkPlain($title1) . '</a>');
+            $this->assertRaw('<a href="' . String::checkPlain($url2) . '"' . $target . '>' . String::checkPlain($title2) . '</a>');
             break;
 
           case 'url_only':
             // In this case, $new_value is an array.
             if (!$new_value['url_only']) {
-              $this->assertRaw('<a href="' . check_plain($url1) . '">' . check_plain($title1) . '</a>');
-              $this->assertRaw('<a href="' . check_plain($url2) . '">' . check_plain($title2) . '</a>');
+              $this->assertRaw('<a href="' . String::checkPlain($url1) . '">' . String::checkPlain($title1) . '</a>');
+              $this->assertRaw('<a href="' . String::checkPlain($url2) . '">' . String::checkPlain($title2) . '</a>');
             }
             else {
               if (empty($new_value['url_plain'])) {
-                $this->assertRaw('<a href="' . check_plain($url1) . '">' . check_plain($url1) . '</a>');
-                $this->assertRaw('<a href="' . check_plain($url2) . '">' . check_plain($url2) . '</a>');
+                $this->assertRaw('<a href="' . String::checkPlain($url1) . '">' . String::checkPlain($url1) . '</a>');
+                $this->assertRaw('<a href="' . String::checkPlain($url2) . '">' . String::checkPlain($url2) . '</a>');
               }
               else {
-                $this->assertNoRaw('<a href="' . check_plain($url1) . '">' . check_plain($url1) . '</a>');
-                $this->assertNoRaw('<a href="' . check_plain($url2) . '">' . check_plain($url2) . '</a>');
-                $this->assertRaw(check_plain($url1));
-                $this->assertRaw(check_plain($url2));
+                $this->assertNoRaw('<a href="' . String::checkPlain($url1) . '">' . String::checkPlain($url1) . '</a>');
+                $this->assertNoRaw('<a href="' . String::checkPlain($url2) . '">' . String::checkPlain($url2) . '</a>');
+                $this->assertRaw(String::checkPlain($url1));
+                $this->assertRaw(String::checkPlain($url2));
               }
             }
             break;
@@ -469,7 +470,7 @@ function testLinkSeparateFormatter() {
             $url = $url1;
             $url_title = isset($new_value) ? truncate_utf8($url, $new_value, FALSE, TRUE) : $url;
             $expected = '<div class="link-item">';
-            $expected .= '<div class="link-url"><a href="' . check_plain($url) . '">' . check_plain($url_title) . '</a></div>';
+            $expected .= '<div class="link-url"><a href="' . String::checkPlain($url) . '">' . String::checkPlain($url_title) . '</a></div>';
             $expected .= '</div>';
             $this->assertRaw($expected);
 
@@ -477,22 +478,22 @@ function testLinkSeparateFormatter() {
             $url_title = isset($new_value) ? truncate_utf8($url, $new_value, FALSE, TRUE) : $url;
             $title = isset($new_value) ? truncate_utf8($title2, $new_value, FALSE, TRUE) : $title2;
             $expected = '<div class="link-item">';
-            $expected .= '<div class="link-title">' . check_plain($title) . '</div>';
-            $expected .= '<div class="link-url"><a href="' . check_plain($url) . '">' . check_plain($url_title) . '</a></div>';
+            $expected .= '<div class="link-title">' . String::checkPlain($title) . '</div>';
+            $expected .= '<div class="link-url"><a href="' . String::checkPlain($url) . '">' . String::checkPlain($url_title) . '</a></div>';
             $expected .= '</div>';
             $this->assertRaw($expected);
             break;
 
           case 'rel':
             $rel = isset($new_value) ? ' rel="' . $new_value . '"' : '';
-            $this->assertRaw('<div class="link-url"><a href="' . check_plain($url1) . '"' . $rel . '>' . check_plain($url1) . '</a></div>');
-            $this->assertRaw('<div class="link-url"><a href="' . check_plain($url2) . '"' . $rel . '>' . check_plain($url2) . '</a></div>');
+            $this->assertRaw('<div class="link-url"><a href="' . String::checkPlain($url1) . '"' . $rel . '>' . String::checkPlain($url1) . '</a></div>');
+            $this->assertRaw('<div class="link-url"><a href="' . String::checkPlain($url2) . '"' . $rel . '>' . String::checkPlain($url2) . '</a></div>');
             break;
 
           case 'target':
             $target = isset($new_value) ? ' target="' . $new_value . '"' : '';
-            $this->assertRaw('<div class="link-url"><a href="' . check_plain($url1) . '"' . $target . '>' . check_plain($url1) . '</a></div>');
-            $this->assertRaw('<div class="link-url"><a href="' . check_plain($url2) . '"' . $target . '>' . check_plain($url2) . '</a></div>');
+            $this->assertRaw('<div class="link-url"><a href="' . String::checkPlain($url1) . '"' . $target . '>' . String::checkPlain($url1) . '</a></div>');
+            $this->assertRaw('<div class="link-url"><a href="' . String::checkPlain($url2) . '"' . $target . '>' . String::checkPlain($url2) . '</a></div>');
             break;
         }
       }
diff --git a/core/modules/link/link.module b/core/modules/link/link.module
index 24c6286..0e830df 100644
--- a/core/modules/link/link.module
+++ b/core/modules/link/link.module
@@ -5,6 +5,8 @@
  * Defines simple link field types.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Implements hook_help().
  */
@@ -60,7 +62,7 @@ function link_theme() {
  */
 function template_preprocess_link_formatter_link_separate(&$variables) {
   if (!empty($variables['title'])) {
-    $variables['title'] = check_plain($variables['title']);
+    $variables['title'] = String::checkPlain($variables['title']);
   }
   $variables['link'] = l($variables['url_title'], $variables['href'], $variables['options']);
 }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php
index 1e9e7ff..aa99f62 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php
@@ -7,16 +7,17 @@
 
 namespace Drupal\node\Plugin\Search;
 
+use Drupal\Component\Utility\String;
+use Drupal\Core\Access\AccessibleInterface;
 use Drupal\Core\Config\Config;
 use Drupal\Core\Database\Connection;
+use Drupal\Core\Database\Query\Condition;
 use Drupal\Core\Database\Query\SelectExtender;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\KeyValueStore\StateInterface;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Session\AccountInterface;
-use Drupal\Core\Access\AccessibleInterface;
-use Drupal\Core\Database\Query\Condition;
 use Drupal\node\NodeInterface;
 use Drupal\search\Plugin\ConfigurableSearchPluginBase;
 use Drupal\search\Plugin\SearchIndexingInterface;
@@ -254,7 +255,7 @@ public function execute() {
       );
       $results[] = array(
         'link' => $node->url('canonical', array('absolute' => TRUE, 'language' => $language)),
-        'type' => check_plain($this->entityManager->getStorageController('node_type')->load($node->bundle())->label()),
+        'type' => String::checkPlain($this->entityManager->getStorageController('node_type')->load($node->bundle())->label()),
         'title' => $node->label(),
         'user' => drupal_render($username),
         'date' => $node->getChangedTime(),
@@ -339,7 +340,7 @@ protected function indexNode(NodeInterface $node) {
       unset($build['#theme']);
       $node->rendered = drupal_render($build);
 
-      $text = '<h1>' . check_plain($node->label($language->id)) . '</h1>' . $node->rendered;
+      $text = '<h1>' . String::checkPlain($node->label($language->id)) . '</h1>' . $node->rendered;
 
       // Fetch extra data normally not visible.
       $extra = $this->moduleHandler->invokeAll('node_update_index', array($node, $language->id));
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Nid.php b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Nid.php
index e7f0e1d..07649d6 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Nid.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Nid.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\node\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\Numeric;
 
 /**
@@ -24,7 +25,7 @@ public function titleQuery() {
 
     $nodes = node_load_multiple($this->value);
     foreach ($nodes as $node) {
-      $titles[] = check_plain($node->label());
+      $titles[] = String::checkPlain($node->label());
     }
     return $titles;
   }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Type.php b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Type.php
index cc88b9f..f21f23c 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Type.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Type.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\node\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\String;
 
 /**
@@ -35,7 +36,7 @@ function title() {
   function node_type($type_name) {
     $type = entity_load('node_type', $type_name);
     $output = $type ? $type->label() : t('Unknown content type');
-    return check_plain($output);
+    return String::checkPlain($output);
   }
 
 }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Vid.php b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Vid.php
index 4f117f6..a5c9e72 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/argument/Vid.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/argument/Vid.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\node\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Database\Connection;
 use Drupal\views\Plugin\views\argument\Numeric;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -66,7 +67,7 @@ public function titleQuery() {
 
     foreach ($results as $result) {
       $nodes[$result['nid']]->set('title', $result['title']);
-      $titles[] = check_plain($nodes[$result['nid']]->label());
+      $titles[] = String::checkPlain($nodes[$result['nid']]->label());
     }
 
     return $titles;
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/argument_validator/Node.php b/core/modules/node/lib/Drupal/node/Plugin/views/argument_validator/Node.php
index fdb3415..07ece93 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/argument_validator/Node.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/argument_validator/Node.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\node\Plugin\views\argument_validator;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
 
 /**
@@ -33,7 +34,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     $types = node_type_get_types();
     $options = array();
     foreach ($types as $type => $info) {
-      $options[$type] = check_plain(t($info->name));
+      $options[$type] = String::checkPlain(t($info->name));
     }
 
     $form['types'] = array(
@@ -97,7 +98,7 @@ public function validateArgument($argument) {
         }
 
         // Save the title() handlers some work.
-        $this->argument->validated_title = check_plain($node->label());
+        $this->argument->validated_title = String::checkPlain($node->label());
 
         if (empty($types)) {
           return TRUE;
@@ -128,7 +129,7 @@ public function validateArgument($argument) {
             }
           }
 
-          $titles[] = check_plain($node->label());
+          $titles[] = String::checkPlain($node->label());
           unset($test[$node->id()]);
         }
 
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php b/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php
index ce50508..a21055d 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/row/Rss.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\node\Plugin\views\row;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\row\RowPluginBase;
 
 /**
@@ -74,7 +75,7 @@ public function buildOptionsForm_summary_options() {
 
   public function summaryTitle() {
     $options = $this->buildOptionsForm_summary_options();
-    return check_plain($options[$this->options['item_length']]);
+    return String::checkPlain($options[$this->options['item_length']]);
   }
 
   public function preRender($values) {
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
index 717abcc..fdb954e 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
@@ -7,8 +7,9 @@
 
 namespace Drupal\node\Tests;
 
-use Drupal\system\Tests\System\TokenReplaceUnitTestBase;
 use Drupal\Component\Utility\String;
+use Drupal\Component\Utility\String;
+use Drupal\system\Tests\System\TokenReplaceUnitTestBase;
 
 /**
  * Test node token replacement in strings.
@@ -73,10 +74,10 @@ function testNodeTokenReplacement() {
     $tests['[node:vid]'] = $node->getRevisionId();
     $tests['[node:type]'] = 'article';
     $tests['[node:type-name]'] = 'Article';
-    $tests['[node:title]'] = check_plain($node->getTitle());
+    $tests['[node:title]'] = String::checkPlain($node->getTitle());
     $tests['[node:body]'] = $node->body->processed;
     $tests['[node:summary]'] = $node->body->summary_processed;
-    $tests['[node:langcode]'] = check_plain($node->language()->id);
+    $tests['[node:langcode]'] = String::checkPlain($node->language()->id);
     $tests['[node:url]'] = url('node/' . $node->id(), $url_options);
     $tests['[node:edit-url]'] = url('node/' . $node->id() . '/edit', $url_options);
     $tests['[node:author]'] = String::checkPlain($account->getUsername());
diff --git a/core/modules/node/node.tokens.inc b/core/modules/node/node.tokens.inc
index dbf668c..cb0e271 100644
--- a/core/modules/node/node.tokens.inc
+++ b/core/modules/node/node.tokens.inc
@@ -5,6 +5,7 @@
  * Builds placeholder replacement tokens for node-related data.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Language\Language;
 
 /**
@@ -116,16 +117,16 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
           break;
 
         case 'type':
-          $replacements[$original] = $sanitize ? check_plain($node->getType()) : $node->getType();
+          $replacements[$original] = $sanitize ? String::checkPlain($node->getType()) : $node->getType();
           break;
 
         case 'type-name':
           $type_name = node_get_type_label($node);
-          $replacements[$original] = $sanitize ? check_plain($type_name) : $type_name;
+          $replacements[$original] = $sanitize ? String::checkPlain($type_name) : $type_name;
           break;
 
         case 'title':
-          $replacements[$original] = $sanitize ? check_plain($node->getTitle()) : $node->getTitle();
+          $replacements[$original] = $sanitize ? String::checkPlain($node->getTitle()) : $node->getTitle();
           break;
 
         case 'body':
@@ -165,7 +166,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
           break;
 
         case 'langcode':
-          $replacements[$original] = $sanitize ? check_plain($node->language()->id) : $node->language()->id;
+          $replacements[$original] = $sanitize ? String::checkPlain($node->language()->id) : $node->language()->id;
           break;
 
         case 'url':
@@ -179,7 +180,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
         // Default values for the chained tokens handled below.
         case 'author':
           $account = $node->getOwner() ? $node->getOwner() : user_load(0);
-          $replacements[$original] = $sanitize ? check_plain($account->label()) : $account->label();
+          $replacements[$original] = $sanitize ? String::checkPlain($account->label()) : $account->label();
           break;
 
         case 'created':
diff --git a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php
index 05ff927..63bf53a 100644
--- a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php
+++ b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\picture\Entity;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Config\Entity\ConfigEntityBase;
 use Drupal\picture\PictureMappingInterface;
 
@@ -115,7 +116,7 @@ public function save() {
   public function createDuplicate() {
     return entity_create('picture_mapping', array(
       'id' => '',
-      'label' => t('Clone of !label', array('!label' => check_plain($this->label()))),
+      'label' => t('Clone of !label', array('!label' => String::checkPlain($this->label()))),
       'mappings' => $this->mappings,
     ));
   }
diff --git a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php
index 1e4b106..6ab7f0e 100644
--- a/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php
+++ b/core/modules/picture/lib/Drupal/picture/PictureMappingFormController.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\picture;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityFormController;
 
 /**
@@ -77,7 +78,7 @@ public function form(array $form, array &$form_state) {
         $label = $multiplier . ' ' . $breakpoint->name . ' [' . $breakpoint->mediaQuery . ']';
         $form['mappings'][$breakpoint_id][$multiplier] = array(
           '#type' => 'select',
-          '#title' => check_plain($label),
+          '#title' => String::checkPlain($label),
           '#options' => $image_styles,
           '#default_value' => $image_style,
           '#description' => $this->t('Select an image style for this breakpoint.'),
diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php b/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php
index 09111bf..2f13cc3 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/views/display/RestExport.php
@@ -8,11 +8,12 @@
 namespace Drupal\rest\Plugin\views\display;
 
 
+use Drupal\Component\Utility\String;
+use Drupal\Core\ContentNegotiation;
 use Drupal\Core\KeyValueStore\StateInterface;
 use Drupal\Core\Routing\RouteProviderInterface;
-use Drupal\Core\ContentNegotiation;
-use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\display\PathPluginBase;
+use Drupal\views\ViewExecutable;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
@@ -295,7 +296,7 @@ public function render() {
     // Wrap the output in a pre tag if this is for a live preview.
     if (!empty($this->view->live_preview)) {
       $build['#prefix'] = '<pre>';
-      $build['#markup'] = check_plain($build['#markup']);
+      $build['#markup'] = String::checkPlain($build['#markup']);
       $build['#suffix'] = '</pre>';
     }
 
diff --git a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
index 5903780..646f2ac 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\rest\Tests\Views;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Tests\Plugin\PluginTestBase;
 use Drupal\views\Tests\ViewTestData;
 
@@ -279,7 +280,7 @@ public function testPreview() {
       $entities[] = $row->_entity;
     }
 
-    $expected = check_plain($serializer->serialize($entities, 'json'));
+    $expected = String::checkPlain($serializer->serialize($entities, 'json'));
 
     $view->display_handler->setContentType('json');
     $view->live_preview = TRUE;
diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php
index e3977cb..702577b 100644
--- a/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php
+++ b/core/modules/search/lib/Drupal/search/Tests/SearchCommentTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\search\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\field\Field;
 
 /**
@@ -110,7 +111,7 @@ function testSearchResultsComment() {
     // Verify that comment is rendered using proper format.
     $this->assertText($comment_body, 'Comment body text found in search results.');
     $this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.');
-    $this->assertNoRaw(check_plain($edit_comment['comment_body[0][value]']), 'HTML in comment body is not escaped.');
+    $this->assertNoRaw(String::checkPlain($edit_comment['comment_body[0][value]']), 'HTML in comment body is not escaped.');
 
     // Hide comments.
     $this->drupalLogin($this->admin_user);
diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index 600dc83..bb154b2 100644
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -5,6 +5,7 @@
  * Enables site-wide keyword searching.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Unicode;
 
 /**
@@ -719,7 +720,7 @@ function search_excerpt($keys, $text, $langcode = NULL) {
     // We didn't find any keyword matches, so just return the first part of the
     // text. We also need to re-encode any HTML special characters that we
     // entity-decoded above.
-    return check_plain(truncate_utf8($text, 256, TRUE, TRUE));
+    return String::checkPlain(truncate_utf8($text, 256, TRUE, TRUE));
   }
 
   // Sort the text ranges by starting position.
@@ -760,7 +761,7 @@ function search_excerpt($keys, $text, $langcode = NULL) {
   // translated. Let translators have the ... separator text as one chunk.
   $dots = explode('!excerpt', t('... !excerpt ... !excerpt ...'));
   $text = (isset($new_ranges[0]) ? '' : $dots[0]) . implode($dots[1], $out) . (($max_end < strlen($text) - 1) ? $dots[2] : '');
-  $text = check_plain($text);
+  $text = String::checkPlain($text);
 
   // Highlight keywords. Must be done at once to prevent conflicts ('strong'
   // and '<strong>').
diff --git a/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc
index ec71855..9fe5efb 100644
--- a/core/modules/search/search.pages.inc
+++ b/core/modules/search/search.pages.inc
@@ -5,6 +5,7 @@
  * User page callbacks for the Search module.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Language\Language;
 
 /**
@@ -35,7 +36,7 @@ function template_preprocess_search_result(&$variables) {
 
   $result = $variables['result'];
   $variables['url'] = check_url($result['link']);
-  $variables['title'] = check_plain($result['title']);
+  $variables['title'] = String::checkPlain($result['title']);
   if (isset($result['language']) && $result['language'] != $language_interface->id && $result['language'] != Language::LANGCODE_NOT_SPECIFIED) {
     $variables['title_attributes']['lang'] = $result['language'];
     $variables['content_attributes']['lang'] = $result['language'];
@@ -43,7 +44,7 @@ function template_preprocess_search_result(&$variables) {
 
   $info = array();
   if (!empty($result['plugin_id'])) {
-    $info['plugin_id'] = check_plain($result['plugin_id']);
+    $info['plugin_id'] = String::checkPlain($result['plugin_id']);
   }
   if (!empty($result['user'])) {
     $info['user'] = $result['user'];
diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc
index 876c9f8..de504fe 100644
--- a/core/modules/shortcut/shortcut.admin.inc
+++ b/core/modules/shortcut/shortcut.admin.inc
@@ -5,6 +5,8 @@
  * Administrative page callbacks for the shortcut module.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Form callback: builds the form for switching shortcut sets.
  *
@@ -38,7 +40,7 @@ function shortcut_set_switch($form, &$form_state, $account = NULL) {
 
   $options = array();
   foreach ($sets as $name => $set) {
-    $options[$name] = check_plain($set->label());
+    $options[$name] = String::checkPlain($set->label());
   }
 
   // Only administrators can add shortcut sets.
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index af66791..a6c38b7 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -10,14 +10,15 @@
 use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Component\Utility\String;
-use Drupal\Core\DrupalKernel;
-use Drupal\Core\Database\Database;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Database\ConnectionNotDefinedException;
+use Drupal\Core\Database\Database;
+use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\DrupalKernel;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Session\UserSession;
 use Drupal\Core\StreamWrapper\PublicStream;
-use Drupal\Core\Datetime\DrupalDateTime;
 use Drupal\block\Entity\Block;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -1402,7 +1403,7 @@ protected function drupalGet($path, array $options = array(), array $headers = a
     $verbose = 'GET request to: ' . $path .
                '<hr />Ending URL: ' . $this->getUrl();
     if ($this->dumpHeaders) {
-      $verbose .= '<hr />Headers: <pre>' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>';
+      $verbose .= '<hr />Headers: <pre>' . String::checkPlain(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>';
     }
     $verbose .= '<hr />' . $out;
 
@@ -1592,7 +1593,7 @@ protected function drupalPostForm($path, $edit, $submit, array $options = array(
           $verbose = 'POST request to: ' . $path;
           $verbose .= '<hr />Ending URL: ' . $this->getUrl();
           if ($this->dumpHeaders) {
-            $verbose .= '<hr />Headers: <pre>' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>';
+            $verbose .= '<hr />Headers: <pre>' . String::checkPlain(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>';
           }
           $verbose .= '<hr />Fields: ' . highlight_string('<?php ' . var_export($post_array, TRUE), TRUE);
           $verbose .= '<hr />' . $out;
@@ -1992,7 +1993,7 @@ protected function drupalHead($path, array $options = array(), array $headers =
     if ($this->dumpHeaders) {
       $this->verbose('GET request to: ' . $path .
                      '<hr />Ending URL: ' . $this->getUrl() .
-                     '<hr />Headers: <pre>' . check_plain(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>');
+                     '<hr />Headers: <pre>' . String::checkPlain(var_export(array_map('trim', $this->headers), TRUE)) . '</pre>');
     }
 
     return $out;
@@ -2995,9 +2996,9 @@ protected function assertNoTitle($title, $message = '', $group = 'Other') {
    */
   protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') {
     $output = theme($callback, $variables);
-    $this->verbose('Variables:' . '<pre>' .  check_plain(var_export($variables, TRUE)) . '</pre>'
-      . '<hr />' . 'Result:' . '<pre>' .  check_plain(var_export($output, TRUE)) . '</pre>'
-      . '<hr />' . 'Expected:' . '<pre>' .  check_plain(var_export($expected, TRUE)) . '</pre>'
+    $this->verbose('Variables:' . '<pre>' .  String::checkPlain(var_export($variables, TRUE)) . '</pre>'
+      . '<hr />' . 'Result:' . '<pre>' .  String::checkPlain(var_export($output, TRUE)) . '</pre>'
+      . '<hr />' . 'Expected:' . '<pre>' .  String::checkPlain(var_export($expected, TRUE)) . '</pre>'
       . '<hr />' . $output
     );
     if (!$message) {
diff --git a/core/modules/simpletest/simpletest.install b/core/modules/simpletest/simpletest.install
index 917a938..6236675 100644
--- a/core/modules/simpletest/simpletest.install
+++ b/core/modules/simpletest/simpletest.install
@@ -5,6 +5,8 @@
  * Install, update and uninstall functions for the simpletest module.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Minimum value of PHP memory_limit for SimpleTest.
  */
@@ -65,7 +67,7 @@ function simpletest_requirements($phase) {
       'value' => is_dir(DRUPAL_ROOT . '/' . $site_directory) ? t('Not writable') : t('Missing'),
       'severity' => REQUIREMENT_ERROR,
       'description' => t('The testing framework requires the !sites-simpletest directory to exist and be writable in order to run tests.', array(
-        '!sites-simpletest' => '<code>./' . check_plain($site_directory) . '</code>',
+        '!sites-simpletest' => '<code>./' . String::checkPlain($site_directory) . '</code>',
       )),
     );
   }
@@ -75,7 +77,7 @@ function simpletest_requirements($phase) {
       'value' => t('Not protected'),
       'severity' => REQUIREMENT_ERROR,
       'description' => t('The file !file does not exist and could not be created automatically, which poses a security risk. Ensure that the directory is writable.', array(
-        '!file' => '<code>./' . check_plain($site_directory) . '/.htaccess</code>',
+        '!file' => '<code>./' . String::checkPlain($site_directory) . '/.htaccess</code>',
       )),
     );
   }
diff --git a/core/modules/system/form.api.php b/core/modules/system/form.api.php
index 36c4c85..f8690aa 100644
--- a/core/modules/system/form.api.php
+++ b/core/modules/system/form.api.php
@@ -5,6 +5,8 @@
  * Calbacks provided by the form system.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * @addtogroup callbacks
  * @{
@@ -74,7 +76,7 @@ function callback_batch_operation($MULTIPLE_PARAMS, &$context) {
     node_save($node);
 
     // Store some result for post-processing in the finished callback.
-    $context['results'][] = check_plain($node->title);
+    $context['results'][] = String::checkPlain($node->title);
 
     // Update our progress information.
     $context['sandbox']['progress']++;
diff --git a/core/modules/system/lib/Drupal/system/Form/FileSystemForm.php b/core/modules/system/lib/Drupal/system/Form/FileSystemForm.php
index 2d51684..56e779d 100644
--- a/core/modules/system/lib/Drupal/system/Form/FileSystemForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/FileSystemForm.php
@@ -7,8 +7,9 @@
 
 namespace Drupal\system\Form;
 
-use Drupal\Core\StreamWrapper\PublicStream;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Form\ConfigFormBase;
+use Drupal\Core\StreamWrapper\PublicStream;
 
 /**
  * Configure file system settings for this site.
@@ -55,7 +56,7 @@ public function buildForm(array $form, array &$form_state) {
     // Any visible, writeable wrapper can potentially be used for the files
     // directory, including a remote file system that integrates with a CDN.
     foreach (file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE) as $scheme => $info) {
-      $options[$scheme] = check_plain($info['description']);
+      $options[$scheme] = String::checkPlain($info['description']);
     }
 
     if (!empty($options)) {
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
index a090c67..5a88e31 100644
--- a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
@@ -7,12 +7,13 @@
 
 namespace Drupal\system\Form;
 
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Unicode;
+use Drupal\Core\Access\AccessManager;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\Core\Access\AccessManager;
 
 /**
  * Provides module installation interface.
@@ -77,7 +78,7 @@ public function getFormId() {
    */
   public function buildForm(array $form, array &$form_state) {
     require_once DRUPAL_ROOT . '/core/includes/install.inc';
-    $distribution = check_plain(drupal_install_profile_distribution_name());
+    $distribution = String::checkPlain(drupal_install_profile_distribution_name());
 
     // Include system.admin.inc so we can use the sort callbacks.
     $this->moduleHandler->loadInclude('system', 'inc', 'system.admin');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
index 5c016ce..536868f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Common;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Language\Language;
 use Drupal\simpletest\DrupalUnitTestBase;
 
@@ -79,7 +80,7 @@ function testRenderFile() {
     $this->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.');
     // Verify that newlines are properly added inside style tags.
     $query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0';
-    $css_processed = '<link rel="stylesheet" href="' . check_plain(file_create_url($css)) . "?" . $query_string . '" media="all" />';
+    $css_processed = '<link rel="stylesheet" href="' . String::checkPlain(file_create_url($css)) . "?" . $query_string . '" media="all" />';
     $this->assertEqual(trim($styles), $css_processed, 'Rendered CSS includes newlines inside style tags for JavaScript use.');
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php
index c42997d..3b7b857 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Common;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -151,8 +152,8 @@ function testDrupalRenderFormElements() {
   protected function assertRenderedElement(array $element, $xpath, array $xpath_args = array()) {
     $original_element = $element;
     $this->drupalSetContent(drupal_render($element));
-    $this->verbose('<pre>' .  check_plain(var_export($original_element, TRUE)) . '</pre>'
-      . '<pre>' .  check_plain(var_export($element, TRUE)) . '</pre>'
+    $this->verbose('<pre>' .  String::checkPlain(var_export($original_element, TRUE)) . '</pre>'
+      . '<pre>' .  String::checkPlain(var_export($element, TRUE)) . '</pre>'
       . '<hr />' . $this->drupalGetContent()
     );
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/TableSortExtenderUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/TableSortExtenderUnitTest.php
index 59eca4a..6876e94 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/TableSortExtenderUnitTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/TableSortExtenderUnitTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Common;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\UnitTestBase;
 use Symfony\Component\HttpFoundation\Request;
 
@@ -43,7 +44,7 @@ function testTableSortInit() {
     $request->query->replace(array());
     \Drupal::getContainer()->set('request', $request);
     $ts = tablesort_init($headers);
-    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE)))));
+    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => String::checkPlain(var_export($ts, TRUE)))));
     $this->assertEqual($ts, $expected_ts, 'Simple table headers sorted correctly.');
 
     // Test with simple table headers plus $_GET parameters that should _not_
@@ -56,7 +57,7 @@ function testTableSortInit() {
     ));
     \Drupal::getContainer()->set('request', $request);
     $ts = tablesort_init($headers);
-    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE)))));
+    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => String::checkPlain(var_export($ts, TRUE)))));
     $this->assertEqual($ts, $expected_ts, 'Simple table headers plus non-overriding $_GET parameters sorted correctly.');
 
     // Test with simple table headers plus $_GET parameters that _should_
@@ -72,7 +73,7 @@ function testTableSortInit() {
     $expected_ts['sort'] = 'desc';
     $expected_ts['query'] = array('alpha' => 'beta');
     $ts = tablesort_init($headers);
-    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE)))));
+    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => String::checkPlain(var_export($ts, TRUE)))));
     $this->assertEqual($ts, $expected_ts, 'Simple table headers plus $_GET parameters sorted correctly.');
 
     // Test complex table headers.
@@ -104,7 +105,7 @@ function testTableSortInit() {
       'sort' => 'desc',
       'query' => array(),
     );
-    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE)))));
+    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => String::checkPlain(var_export($ts, TRUE)))));
     $this->assertEqual($ts, $expected_ts, 'Complex table headers sorted correctly.');
 
     // Test complex table headers plus $_GET parameters that should _not_
@@ -123,7 +124,7 @@ function testTableSortInit() {
       'sort' => 'asc',
       'query' => array(),
     );
-    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE)))));
+    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => String::checkPlain(var_export($ts, TRUE)))));
     $this->assertEqual($ts, $expected_ts, 'Complex table headers plus non-overriding $_GET parameters sorted correctly.');
 
     // Test complex table headers plus $_GET parameters that _should_
@@ -144,7 +145,7 @@ function testTableSortInit() {
       'query' => array('alpha' => 'beta'),
     );
     $ts = tablesort_init($headers);
-    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => check_plain(var_export($ts, TRUE)))));
+    $this->verbose(strtr('$ts: <pre>!ts</pre>', array('!ts' => String::checkPlain(var_export($ts, TRUE)))));
     $this->assertEqual($ts, $expected_ts, 'Complex table headers plus $_GET parameters sorted correctly.');
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php
index 5424f66..1c3b95a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Form;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 class FormTest extends WebTestBase {
@@ -600,7 +601,7 @@ function testDisabledMarkup() {
       $path = strtr($path, array('!type' => $type));
       // Verify that the element exists.
       $element = $this->xpath($path, array(
-        ':name' => check_plain($name),
+        ':name' => String::checkPlain($name),
         ':div-class' => $class,
         ':value' => isset($item['#value']) ? $item['#value'] : '',
       ));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Mail/HtmlToTextTest.php b/core/modules/system/lib/Drupal/system/Tests/Mail/HtmlToTextTest.php
index 751bf0c..cf4524c 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Mail/HtmlToTextTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Mail/HtmlToTextTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Mail;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -36,7 +37,7 @@ protected function stringToHtml($text) {
       str_replace(
         array("\n", ' '),
         array('\n', '&nbsp;'),
-        check_plain($text)
+        String::checkPlain($text)
       ) . '"';
   }
 
@@ -58,7 +59,7 @@ protected function assertHtmlToText($html, $text, $message, $allowed_tags = NULL
     $tested_tags = implode(', ', array_unique($matches[1]));
     $message .= ' (' . $tested_tags . ')';
     $result = drupal_html_to_text($html, $allowed_tags);
-    $pass = $this->assertEqual($result, $text, check_plain($message));
+    $pass = $this->assertEqual($result, $text, String::checkPlain($message));
     $verbose = 'html = <pre>' . $this->stringToHtml($html)
       . '</pre><br />' . 'result = <pre>' . $this->stringToHtml($result)
       . '</pre><br />' . 'expected = <pre>' . $this->stringToHtml($text)
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
index 2ad1ab4..db1dcb4 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Menu;
 
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Unicode;
 
 /**
@@ -271,7 +272,7 @@ function testBreadCrumbs() {
         $link['link_path'] => $link['link_title'],
       );
       $this->assertBreadcrumb($link['link_path'], $trail, $term->label(), $tree);
-      $this->assertRaw(check_plain($parent->getTitle()), 'Tagged node found.');
+      $this->assertRaw(String::checkPlain($parent->getTitle()), 'Tagged node found.');
 
       // Additionally make sure that this link appears only once; i.e., the
       // untranslated menu links automatically generated from menu router items
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
index 4dd3e1a..490b7d4 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Menu;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -120,7 +121,7 @@ protected function doTestDescriptionMenuItems() {
     // Verify that the menu router item title is output as page title.
     $this->drupalGet('menu_callback_description');
     $this->assertText(t('Menu item description text'));
-    $this->assertRaw(check_plain('<strong>Menu item description arguments</strong>'));
+    $this->assertRaw(String::checkPlain('<strong>Menu item description arguments</strong>'));
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuTestBase.php
index d205b13..fc896d8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Menu;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 abstract class MenuTestBase extends WebTestBase {
@@ -65,7 +66,7 @@ protected function assertBreadcrumbParts($trail) {
       foreach ($trail as $path => $title) {
         $url = url($path);
         $part = array_shift($parts);
-        $pass = ($pass && $part['href'] === $url && $part['text'] === check_plain($title));
+        $pass = ($pass && $part['href'] === $url && $part['text'] === String::checkPlain($title));
       }
     }
     // No parts must be left, or an expected "Home" will always pass.
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
index 33f2f47..f3e3e5e 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/PageTitleTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\System;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Utility\Title;
 use Drupal\simpletest\WebTestBase;
 
@@ -80,7 +81,7 @@ function testTitleTags() {
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $this->assertNotNull($node, 'Node created and found in database');
     $this->drupalGet("node/" . $node->id());
-    $this->assertText(check_plain($edit['title[0][value]']), 'Check to make sure tags in the node title are converted.');
+    $this->assertText(String::checkPlain($edit['title[0][value]']), 'Check to make sure tags in the node title are converted.');
   }
   /**
    * Test if the title of the site is XSS proof.
@@ -88,7 +89,7 @@ function testTitleTags() {
   function testTitleXSS() {
     // Set some title with JavaScript and HTML chars to escape.
     $title = '</title><script type="text/javascript">alert("Title XSS!");</script> & < > " \' ';
-    $title_filtered = check_plain($title);
+    $title_filtered = String::checkPlain($title);
 
     $slogan = '<script type="text/javascript">alert("Slogan XSS!");</script>';
     $slogan_filtered = filter_xss_admin($slogan);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
index 586e1eb..d01f68e 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Theme;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Session\UserSession;
 use Drupal\simpletest\WebTestBase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
@@ -198,10 +199,10 @@ function testLinks() {
 
     $expected_links = '';
     $expected_links .= '<ul id="somelinks">';
-    $expected_links .= '<li class="a-link"><a href="' . url('a/link') . '">' . check_plain('A <link>') . '</a></li>';
-    $expected_links .= '<li class="plain-text">' . check_plain('Plain "text"') . '</li>';
-    $expected_links .= '<li class="front-page"><a href="' . url('<front>') . '">' . check_plain('Front page') . '</a></li>';
-    $expected_links .= '<li class="router-test"><a href="' . \Drupal::urlGenerator()->generate('router_test.1') . '">' . check_plain('Test route') . '</a></li>';
+    $expected_links .= '<li class="a-link"><a href="' . url('a/link') . '">' . String::checkPlain('A <link>') . '</a></li>';
+    $expected_links .= '<li class="plain-text">' . String::checkPlain('Plain "text"') . '</li>';
+    $expected_links .= '<li class="front-page"><a href="' . url('<front>') . '">' . String::checkPlain('Front page') . '</a></li>';
+    $expected_links .= '<li class="router-test"><a href="' . \Drupal::urlGenerator()->generate('router_test.1') . '">' . String::checkPlain('Test route') . '</a></li>';
     $expected_links .= '</ul>';
 
     // Verify that passing a string as heading works.
@@ -234,10 +235,10 @@ function testLinks() {
     );
     $expected_links = '';
     $expected_links .= '<ul id="somelinks">';
-    $expected_links .= '<li class="a-link"><a href="' . url('a/link') . '" class="a/class">' . check_plain('A <link>') . '</a></li>';
-    $expected_links .= '<li class="plain-text"><span class="a/class">' . check_plain('Plain "text"') . '</span></li>';
-    $expected_links .= '<li class="front-page"><a href="' . url('<front>') . '">' . check_plain('Front page') . '</a></li>';
-    $expected_links .= '<li class="router-test"><a href="' . \Drupal::urlGenerator()->generate('router_test.1') . '">' . check_plain('Test route') . '</a></li>';
+    $expected_links .= '<li class="a-link"><a href="' . url('a/link') . '" class="a/class">' . String::checkPlain('A <link>') . '</a></li>';
+    $expected_links .= '<li class="plain-text"><span class="a/class">' . String::checkPlain('Plain "text"') . '</span></li>';
+    $expected_links .= '<li class="front-page"><a href="' . url('<front>') . '">' . String::checkPlain('Front page') . '</a></li>';
+    $expected_links .= '<li class="router-test"><a href="' . \Drupal::urlGenerator()->generate('router_test.1') . '">' . String::checkPlain('Test route') . '</a></li>';
     $expected_links .= '</ul>';
     $expected = $expected_heading . $expected_links;
     $this->assertThemeOutput('links', $variables, $expected);
@@ -247,10 +248,10 @@ function testLinks() {
     $variables['set_active_class'] = TRUE;
     $expected_links = '';
     $expected_links .= '<ul id="somelinks">';
-    $expected_links .= '<li class="a-link" data-drupal-link-system-path="a/link"><a href="' . url('a/link') . '" class="a/class" data-drupal-link-system-path="a/link">' . check_plain('A <link>') . '</a></li>';
-    $expected_links .= '<li class="plain-text"><span class="a/class">' . check_plain('Plain "text"') . '</span></li>';
-    $expected_links .= '<li class="front-page" data-drupal-link-system-path="&lt;front&gt;"><a href="' . url('<front>') . '" data-drupal-link-system-path="&lt;front&gt;">' . check_plain('Front page') . '</a></li>';
-    $expected_links .= '<li class="router-test" data-drupal-link-system-path="router_test/test1"><a href="' . \Drupal::urlGenerator()->generate('router_test.1') . '" data-drupal-link-system-path="router_test/test1">' . check_plain('Test route') . '</a></li>';
+    $expected_links .= '<li class="a-link" data-drupal-link-system-path="a/link"><a href="' . url('a/link') . '" class="a/class" data-drupal-link-system-path="a/link">' . String::checkPlain('A <link>') . '</a></li>';
+    $expected_links .= '<li class="plain-text"><span class="a/class">' . String::checkPlain('Plain "text"') . '</span></li>';
+    $expected_links .= '<li class="front-page" data-drupal-link-system-path="&lt;front&gt;"><a href="' . url('<front>') . '" data-drupal-link-system-path="&lt;front&gt;">' . String::checkPlain('Front page') . '</a></li>';
+    $expected_links .= '<li class="router-test" data-drupal-link-system-path="router_test/test1"><a href="' . \Drupal::urlGenerator()->generate('router_test.1') . '" data-drupal-link-system-path="router_test/test1">' . String::checkPlain('Test route') . '</a></li>';
     $expected_links .= '</ul>';
     $expected = $expected_heading . $expected_links;
     $this->assertThemeOutput('links', $variables, $expected);
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index 59dfce0..134d8e1 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -5,6 +5,7 @@
  * Hooks provided by Drupal core and the System module.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Utility\UpdateException;
 
 /**
@@ -2729,7 +2730,7 @@ function hook_tokens($type, $tokens, array $data = array(), array $options = arr
           break;
 
         case 'title':
-          $replacements[$original] = $sanitize ? check_plain($node->getTitle()) : $node->getTitle();
+          $replacements[$original] = $sanitize ? String::checkPlain($node->getTitle()) : $node->getTitle();
           break;
 
         case 'edit-url':
@@ -2739,7 +2740,7 @@ function hook_tokens($type, $tokens, array $data = array(), array $options = arr
         // Default values for the chained tokens handled below.
         case 'author':
           $account = $node->getOwner() ? $node->getOwner() : user_load(0);
-          $replacements[$original] = $sanitize ? check_plain($account->label()) : $account->label();
+          $replacements[$original] = $sanitize ? String::checkPlain($account->label()) : $account->label();
           break;
 
         case 'created':
diff --git a/core/modules/system/system.tokens.inc b/core/modules/system/system.tokens.inc
index 4c27e2c..05e35ac 100644
--- a/core/modules/system/system.tokens.inc
+++ b/core/modules/system/system.tokens.inc
@@ -7,6 +7,8 @@
  * This file handles tokens for the global 'site' and 'date' tokens.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Implements hook_token_info().
  */
@@ -104,7 +106,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
       switch ($name) {
         case 'name':
           $site_name = \Drupal::config('system.site')->get('name');
-          $replacements[$original] = $sanitize ? check_plain($site_name) : $site_name;
+          $replacements[$original] = $sanitize ? String::checkPlain($site_name) : $site_name;
           break;
 
         case 'slogan':
@@ -158,7 +160,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
           break;
 
         case 'raw':
-          $replacements[$original] = $sanitize ? check_plain($date) : $date;
+          $replacements[$original] = $sanitize ? String::checkPlain($date) : $date;
           break;
       }
     }
diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestViewBuilder.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestViewBuilder.php
index 6805765..8f5efad 100644
--- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestViewBuilder.php
+++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestViewBuilder.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\entity_test;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\EntityViewBuilder;
 
 /**
@@ -24,13 +25,13 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang
 
     foreach ($entities as $entity) {
       $entity->content['label'] = array(
-        '#markup' => check_plain($entity->label()),
+        '#markup' => String::checkPlain($entity->label()),
       );
       $entity->content['separator'] = array(
         '#markup' => ' | ',
       );
       $entity->content['view_mode'] = array(
-        '#markup' => check_plain($view_mode),
+        '#markup' => String::checkPlain($view_mode),
       );
     }
   }
diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module
index 0e8bdb9..13a1cd7 100644
--- a/core/modules/system/tests/modules/form_test/form_test.module
+++ b/core/modules/system/tests/modules/form_test/form_test.module
@@ -6,13 +6,14 @@
  */
 
 use Drupal\Component\Utility\Json;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Database\Connection;
 use Drupal\Core\Database\Database;
+use Drupal\Core\Datetime\DrupalDateTime;
 use Drupal\Core\Language\Language;
 use Drupal\form_test\Callbacks;
 use Drupal\form_test\FormTestObject;
 use Drupal\form_test\SystemConfigFormTestForm;
-use Drupal\Core\Datetime\DrupalDateTime;
 use Symfony\Component\HttpFoundation\JsonResponse;
 
 /**
@@ -643,7 +644,7 @@ function form_storage_test_form_continue_submit($form, &$form_state) {
  * Form submit handler to finish multi-step form.
  */
 function form_test_storage_form_submit($form, &$form_state) {
-  drupal_set_message("Title: " . check_plain($form_state['values']['title']));
+  drupal_set_message("Title: " . String::checkPlain($form_state['values']['title']));
   drupal_set_message("Form constructions: " . $_SESSION['constructions']);
   if (isset($form_state['storage']['thing']['changed'])) {
     drupal_set_message("The thing has been changed.");
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/LinkFormatter.php
index f7d0325..52d92e7 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/LinkFormatter.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/LinkFormatter.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\Field\FieldFormatter;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldItemListInterface;
 
 /**
@@ -33,7 +34,7 @@ public function viewElements(FieldItemListInterface $items) {
     foreach ($items as $delta => $item) {
       if (!$item->target_id) {
         $elements[$delta] = array(
-          '#markup' => check_plain($item->entity->label()),
+          '#markup' => String::checkPlain($item->entity->label()),
         );
       }
       else {
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/PlainFormatter.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/PlainFormatter.php
index 826db27..61bc262 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/PlainFormatter.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Field/FieldFormatter/PlainFormatter.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\Field\FieldFormatter;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldItemListInterface;
 
 /**
@@ -30,7 +31,7 @@ public function viewElements(FieldItemListInterface $items) {
 
     foreach ($items as $delta => $item) {
       $elements[$delta] = array(
-        '#markup' => check_plain($item->entity->label()),
+        '#markup' => String::checkPlain($item->entity->label()),
       );
     }
 
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTid.php
index abe16ea..f0fd94c 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTid.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\ManyToOne;
 
 /**
@@ -25,7 +26,7 @@ public function titleQuery() {
       ->condition('td.tid', $this->value)
       ->execute();
     foreach ($result as $term) {
-      $titles[] = check_plain($term->name);
+      $titles[] = String::checkPlain($term->name);
     }
     return $titles;
   }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTidDepth.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTidDepth.php
index 84c9415..faf76a8 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTidDepth.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/IndexTidDepth.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
 
 /**
@@ -121,7 +122,7 @@ public function query($group_by = FALSE) {
   function title() {
     $term = entity_load('taxonomy_term', $this->argument);
     if (!empty($term)) {
-      return check_plain($term->label());
+      return String::checkPlain($term->label());
     }
     // TODO review text
     return t('No name');
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/Taxonomy.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/Taxonomy.php
index d1f75c6..a8ee992 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/Taxonomy.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/Taxonomy.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\Numeric;
 
 /**
@@ -26,7 +27,7 @@ function title() {
     if ($this->argument) {
       $term = entity_load('taxonomy_term', $this->argument);
       if (!empty($term)) {
-        return check_plain($term->label());
+        return String::checkPlain($term->label());
       }
     }
     // TODO review text
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php
index aa9a582..b1f1a71 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument/VocabularyVid.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Plugin\views\argument;
 
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\argument\Numeric;
 
 /**
@@ -24,7 +25,7 @@ class VocabularyVid extends Numeric {
   function title() {
     $vocabulary = entity_load('taxonomy_vocabulary', $this->argument);
     if ($vocabulary) {
-      return check_plain($vocabulary->label());
+      return String::checkPlain($vocabulary->label());
     }
 
     return t('No vocabulary');
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php
index bb6d43b..a4c4a3b 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php
@@ -7,9 +7,10 @@
 
 namespace Drupal\taxonomy\Plugin\views\field;
 
-use Drupal\views\ViewExecutable;
+use Drupal\Component\Utility\String;
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\Plugin\views\field\PrerenderList;
+use Drupal\views\ViewExecutable;
 
 /**
  * Field handler to display all taxonomy terms of a node.
@@ -116,10 +117,10 @@ public function preRender(&$values) {
       $result = $query->execute();
 
       foreach ($result as $term) {
-        $this->items[$term->node_nid][$term->tid]['name'] = check_plain($term->name);
+        $this->items[$term->node_nid][$term->tid]['name'] = String::checkPlain($term->name);
         $this->items[$term->node_nid][$term->tid]['tid'] = $term->tid;
         $this->items[$term->node_nid][$term->tid]['vocabulary_vid'] = $term->vid;
-        $this->items[$term->node_nid][$term->tid]['vocabulary'] = check_plain($vocabularies[$term->vid]->label());
+        $this->items[$term->node_nid][$term->tid]['vocabulary'] = String::checkPlain($vocabularies[$term->vid]->label());
 
         if (!empty($this->options['link_to_taxonomy'])) {
           $this->items[$term->node_nid][$term->tid]['make_link'] = TRUE;
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
index a84f400..fbc469a 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\taxonomy\Tests;
 
 use Drupal\Component\Utility\Json;
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Tags;
 use Drupal\Core\Field\FieldDefinitionInterface;
 
@@ -263,8 +264,8 @@ function testTermAutocompletion() {
     // The result order is not guaranteed, so check each term separately.
     $result = $this->drupalGet($path, array('query' => array('q' => $input)));
     $data = drupal_json_decode($result);
-    $this->assertEqual($data[0]['label'], check_plain($first_term->label()), 'Autocomplete returned the first matching term');
-    $this->assertEqual($data[1]['label'], check_plain($second_term->label()), 'Autocomplete returned the second matching term');
+    $this->assertEqual($data[0]['label'], String::checkPlain($first_term->label()), 'Autocomplete returned the first matching term');
+    $this->assertEqual($data[1]['label'], String::checkPlain($second_term->label()), 'Autocomplete returned the second matching term');
 
     // Try to autocomplete a term name that matches first term.
     // We should only get the first term in a json encoded string.
@@ -272,7 +273,7 @@ function testTermAutocompletion() {
     $path = 'taxonomy/autocomplete/node/taxonomy_' . $this->vocabulary->id();
     $this->drupalGet($path, array('query' => array('q' => $input)));
     $target = array(array(
-      'value' => check_plain($first_term->label()),
+      'value' => String::checkPlain($first_term->label()),
       'label' => $first_term->label(),
     ));
     $this->assertRaw(Json::encode($target), 'Autocomplete returns only the expected matching term.');
@@ -285,7 +286,7 @@ function testTermAutocompletion() {
     $n = Tags::encode($third_term->label());
     $target = array(array(
       'value' => $n,
-      'label' => check_plain($third_term->label()),
+      'label' => String::checkPlain($third_term->label()),
     ));
     $this->assertRaw(Json::encode($target), 'Autocomplete returns a term containing a comma and a slash.');
   }
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
index a91675c..7de8181 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Language\Language;
 
@@ -87,12 +88,12 @@ function testTaxonomyTokenReplacement() {
     // Generate and test sanitized tokens for term1.
     $tests = array();
     $tests['[term:tid]'] = $term1->id();
-    $tests['[term:name]'] = check_plain($term1->name->value);
+    $tests['[term:name]'] = String::checkPlain($term1->name->value);
     $tests['[term:description]'] = $term1->description->processed;
     $tests['[term:url]'] = url('taxonomy/term/' . $term1->id(), array('absolute' => TRUE));
     $tests['[term:node-count]'] = 0;
     $tests['[term:parent:name]'] = '[term:parent:name]';
-    $tests['[term:vocabulary:name]'] = check_plain($this->vocabulary->name);
+    $tests['[term:vocabulary:name]'] = String::checkPlain($this->vocabulary->name);
 
     foreach ($tests as $input => $expected) {
       $output = $token_service->replace($input, array('term' => $term1), array('langcode' => $language_interface->id));
@@ -102,14 +103,14 @@ function testTaxonomyTokenReplacement() {
     // Generate and test sanitized tokens for term2.
     $tests = array();
     $tests['[term:tid]'] = $term2->id();
-    $tests['[term:name]'] = check_plain($term2->name->value);
+    $tests['[term:name]'] = String::checkPlain($term2->name->value);
     $tests['[term:description]'] = $term2->description->processed;
     $tests['[term:url]'] = url('taxonomy/term/' . $term2->id(), array('absolute' => TRUE));
     $tests['[term:node-count]'] = 1;
-    $tests['[term:parent:name]'] = check_plain($term1->name->value);
+    $tests['[term:parent:name]'] = String::checkPlain($term1->name->value);
     $tests['[term:parent:url]'] = url('taxonomy/term/' . $term1->id(), array('absolute' => TRUE));
     $tests['[term:parent:parent:name]'] = '[term:parent:parent:name]';
-    $tests['[term:vocabulary:name]'] = check_plain($this->vocabulary->name);
+    $tests['[term:vocabulary:name]'] = String::checkPlain($this->vocabulary->name);
 
     // Test to make sure that we generated something for each token.
     $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
@@ -133,7 +134,7 @@ function testTaxonomyTokenReplacement() {
     // Generate and test sanitized tokens.
     $tests = array();
     $tests['[vocabulary:vid]'] = $this->vocabulary->id();
-    $tests['[vocabulary:name]'] = check_plain($this->vocabulary->name);
+    $tests['[vocabulary:name]'] = String::checkPlain($this->vocabulary->name);
     $tests['[vocabulary:description]'] = filter_xss($this->vocabulary->description);
     $tests['[vocabulary:node-count]'] = 1;
     $tests['[vocabulary:term-count]'] = 2;
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index b85cc96..4d930ba 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -5,9 +5,10 @@
  * Enables the organization of content into categories.
  */
 
+use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Tags;
-use Drupal\Core\Entity\FieldableDatabaseStorageController;
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\FieldableDatabaseStorageController;
 use Drupal\file\FileInterface;
 use Drupal\node\Entity\Node;
 use Drupal\taxonomy\Entity\Term;
@@ -404,7 +405,7 @@ function template_preprocess_taxonomy_term(&$variables) {
 
   $variables['url'] = $term->url();
   // We use name here because that is what appears in the UI.
-  $variables['name'] = check_plain($term->label());
+  $variables['name'] = String::checkPlain($term->label());
   $variables['page'] = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term);
 
   // Helpful $content variable for templates.
diff --git a/core/modules/taxonomy/taxonomy.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc
index eec9d73..1234361 100644
--- a/core/modules/taxonomy/taxonomy.tokens.inc
+++ b/core/modules/taxonomy/taxonomy.tokens.inc
@@ -5,6 +5,8 @@
  * Builds placeholder replacement tokens for taxonomy terms and vocabularies.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Implements hook_token_info().
  */
@@ -104,7 +106,7 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
           break;
 
         case 'name':
-          $replacements[$original] = $sanitize ? check_plain($term->name->value) : $term->name->value;
+          $replacements[$original] = $sanitize ? String::checkPlain($term->name->value) : $term->name->value;
           break;
 
         case 'description':
@@ -125,13 +127,13 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
 
         case 'vocabulary':
           $vocabulary = entity_load('taxonomy_vocabulary', $term->bundle());
-          $replacements[$original] = check_plain($vocabulary->name);
+          $replacements[$original] = String::checkPlain($vocabulary->name);
           break;
 
         case 'parent':
           if ($parents = taxonomy_term_load_parents($term->id())) {
             $parent = array_pop($parents);
-            $replacements[$original] = check_plain($parent->name->value);
+            $replacements[$original] = String::checkPlain($parent->name->value);
           }
           break;
       }
@@ -158,7 +160,7 @@ function taxonomy_tokens($type, $tokens, array $data = array(), array $options =
           break;
 
         case 'name':
-          $replacements[$original] = $sanitize ? check_plain($vocabulary->name) : $vocabulary->name;
+          $replacements[$original] = $sanitize ? String::checkPlain($vocabulary->name) : $vocabulary->name;
           break;
 
         case 'description':
diff --git a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldFormatter/TextPlainFormatter.php b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldFormatter/TextPlainFormatter.php
index 6c15bf5..22bb681 100644
--- a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldFormatter/TextPlainFormatter.php
+++ b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldFormatter/TextPlainFormatter.php
@@ -7,8 +7,9 @@
 
 namespace Drupal\text\Plugin\Field\FieldFormatter;
 
-use Drupal\Core\Field\FormatterBase;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Field\FormatterBase;
 
 /**
  * Plugin implementation of the 'text_plain' formatter.
@@ -37,7 +38,7 @@ public function viewElements(FieldItemListInterface $items) {
     foreach ($items as $delta => $item) {
       // The text value has no text format assigned to it, so the user input
       // should equal the output, including newlines.
-      $elements[$delta] = array('#markup' => nl2br(check_plain($item->value)));
+      $elements[$delta] = array('#markup' => nl2br(String::checkPlain($item->value)));
     }
 
     return $elements;
diff --git a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
index 2890f27..6eaaeee 100644
--- a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
+++ b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\text\Tests\Formatter;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
 use Drupal\Core\Language\Language;
@@ -305,7 +306,7 @@ function testPlainText() {
     $this->renderEntityFields($entity, $this->display);
     $this->assertText($value);
     $this->assertNoRaw($value);
-    $this->assertRaw(nl2br(check_plain($value)));
+    $this->assertRaw(nl2br(String::checkPlain($value)));
   }
 
 }
diff --git a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
index e68a752..663d964 100644
--- a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
+++ b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\text\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -215,7 +216,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) {
     $content = $display->build($entity);
     $this->drupalSetContent(drupal_render($content));
     $this->assertNoRaw($value, 'HTML tags are not displayed.');
-    $this->assertRaw(check_plain($value), 'Escaped HTML is displayed correctly.');
+    $this->assertRaw(String::checkPlain($value), 'Escaped HTML is displayed correctly.');
 
     // Create a new text format that does not escape HTML, and grant the user
     // access to it.
diff --git a/core/modules/text/lib/Drupal/text/TextProcessed.php b/core/modules/text/lib/Drupal/text/TextProcessed.php
index d07a196..414dace 100644
--- a/core/modules/text/lib/Drupal/text/TextProcessed.php
+++ b/core/modules/text/lib/Drupal/text/TextProcessed.php
@@ -7,9 +7,10 @@
 
 namespace Drupal\text;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\TypedData\DataDefinitionInterface;
-use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Core\TypedData\TypedData;
+use Drupal\Core\TypedData\TypedDataInterface;
 
 /**
  * A computed property for processing text with a format.
@@ -58,7 +59,7 @@ public function getValue($langcode = NULL) {
     else {
       // Escape all HTML and retain newlines.
       // @see \Drupal\text\Plugin\field\formatter\TextPlainFormatter
-      $this->processed = nl2br(check_plain($text));
+      $this->processed = nl2br(String::checkPlain($text));
     }
     return $this->processed;
   }
diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index d91527b..574d0e2 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -5,14 +5,15 @@
  * Administration toolbar for quick access to top level administration items.
  */
 
+use Drupal\Component\Utility\Crypt;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Template\Attribute;
-use Drupal\Component\Utility\Crypt;
-use Symfony\Component\HttpFoundation\Response;
 use Drupal\menu_link\MenuLinkInterface;
 use Drupal\user\RoleInterface;
 use Drupal\user\UserInterface;
+use Symfony\Component\HttpFoundation\Response;
 
 /**
  * Implements hook_help().
@@ -457,7 +458,7 @@ function toolbar_menu_navigation_links(&$tree) {
         'toolbar-icon',
         'toolbar-icon-' . strtolower(str_replace(' ', '-', $item['link']['link_title'])),
       ),
-      'title' => check_plain($item['link']['description']),
+      'title' => String::checkPlain($item['link']['description']),
     );
   }
 }
diff --git a/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php b/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php
index d883490..74ad089 100644
--- a/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php
+++ b/core/modules/tour/lib/Drupal/tour/Plugin/tour/tip/TipPluginText.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\tour\Plugin\tour\tip;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Utility\Token;
 use Drupal\tour\TipPluginBase;
@@ -118,7 +119,7 @@ public function getAttributes() {
    * Implements \Drupal\tour\TipPluginInterface::getOutput().
    */
   public function getOutput() {
-    $output = '<h2 class="tour-tip-label" id="tour-tip-' . $this->getAriaId() . '-label">' . check_plain($this->getLabel()) . '</h2>';
+    $output = '<h2 class="tour-tip-label" id="tour-tip-' . $this->getAriaId() . '-label">' . String::checkPlain($this->getLabel()) . '</h2>';
     $output .= '<p class="tour-tip-body" id="tour-tip-' . $this->getAriaId() . '-contents">' . filter_xss_admin($this->token->replace($this->getBody())) . '</p>';
     return array('#markup' => $output);
   }
diff --git a/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php b/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php
index 79ed03c..89f051a 100644
--- a/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php
+++ b/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Plugin/tour/tip/TipPluginImage.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\tour_test\Plugin\tour\tip;
 
+use Drupal\Component\Utility\String;
 use Drupal\tour\TipPluginBase;
 
 /**
@@ -44,7 +45,7 @@ public function getOutput() {
       '#uri' => $this->get('url'),
       '#alt' => $this->get('alt'),
     );
-    $output = '<h2 class="tour-tip-label" id="tour-tip-' . $this->get('ariaId') . '-label">' . check_plain($this->get('label')) . '</h2>';
+    $output = '<h2 class="tour-tip-label" id="tour-tip-' . $this->get('ariaId') . '-label">' . String::checkPlain($this->get('label')) . '</h2>';
     $output .= '<p class="tour-tip-image" id="tour-tip-' . $this->get('ariaId') . '-contents">' . drupal_render($image) . '</p>';
     return array('#markup' => $output);
   }
diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc
index e94c163..bcde379 100644
--- a/core/modules/tracker/tracker.pages.inc
+++ b/core/modules/tracker/tracker.pages.inc
@@ -6,6 +6,8 @@
  */
 
 
+use Drupal\Component\Utility\String;
+
 /**
  * Page callback: Generates a page of tracked nodes for the site.
  *
@@ -86,7 +88,7 @@ function tracker_page($account = NULL) {
       );
 
       $row = array(
-        'type' => check_plain(node_get_type_label($node)),
+        'type' => String::checkPlain(node_get_type_label($node)),
         'title' => array('data' => l($node->getTitle(), 'node/' . $node->id()) . ' ' . drupal_render($mark_build)),
         'author' => array('data' => array('#theme' => 'username', '#account' => $node->getOwner())),
         'replies' => array('class' => array('replies'), 'data' => $comments),
diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc
index 19c0dc1..5481b59 100644
--- a/core/modules/update/update.manager.inc
+++ b/core/modules/update/update.manager.inc
@@ -36,8 +36,9 @@
  * root.
  */
 
-use Drupal\Core\Updater\Updater;
+use Drupal\Component\Utility\String;
 use Drupal\Core\FileTransfer\Local;
+use Drupal\Core\Updater\Updater;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 
 /**
@@ -108,14 +109,14 @@ function update_manager_update_form($form, $form_state = array(), $context) {
         $project_name = l($project['title'], $project['link']);
       }
       else {
-        $project_name = check_plain($project['title']);
+        $project_name = String::checkPlain($project['title']);
       }
     }
     elseif (!empty($project['info']['name'])) {
-      $project_name = check_plain($project['info']['name']);
+      $project_name = String::checkPlain($project['info']['name']);
     }
     else {
-      $project_name = check_plain($name);
+      $project_name = String::checkPlain($name);
     }
     if ($project['project_type'] == 'theme' || $project['project_type'] == 'theme-disabled') {
       $project_name .= ' ' . t('(Theme)');
diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc
index 51da7dd..579f461 100644
--- a/core/modules/update/update.report.inc
+++ b/core/modules/update/update.report.inc
@@ -5,6 +5,8 @@
  * Code required only when rendering the available updates report.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Returns HTML for the project status report.
  *
@@ -83,7 +85,7 @@ function theme_update_report($variables) {
     $row = '<div class="version-status">';
     $update_status_label = array('#theme' => 'update_status_label', '#status' => $project['status']);
     $status_label = drupal_render($update_status_label);
-    $row .= !empty($status_label) ? $status_label : check_plain($project['reason']);
+    $row .= !empty($status_label) ? $status_label : String::checkPlain($project['reason']);
     $row .= '<span class="icon">' . drupal_render($icon) . '</span>';
     $row .= "</div>\n";
 
@@ -93,13 +95,13 @@ function theme_update_report($variables) {
         $row .= l($project['title'], $project['link']);
       }
       else {
-        $row .= check_plain($project['title']);
+        $row .= String::checkPlain($project['title']);
       }
     }
     else {
-      $row .= check_plain($project['name']);
+      $row .= String::checkPlain($project['name']);
     }
-    $row .= ' ' . check_plain($project['existing_version']);
+    $row .= ' ' . String::checkPlain($project['existing_version']);
     if ($project['install_type'] == 'dev' && !empty($project['datestamp'])) {
       $row .= ' <span class="version-date">(' . format_date($project['datestamp'], 'custom', 'Y-M-d') . ')</span>';
     }
@@ -201,7 +203,7 @@ function theme_update_report($variables) {
       $row .= '<div class="extra">' . "\n";
       foreach ($project['extra'] as $value) {
         $row .= '<div class="' . implode(' ', $value['class']) . '">';
-        $row .= check_plain($value['label']) . ': ';
+        $row .= String::checkPlain($value['label']) . ': ';
         $row .= drupal_placeholder($value['data']);
         $row .= "</div>\n";
       }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php b/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php
index a50ac39..507b2db 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php
@@ -7,9 +7,10 @@
 
 namespace Drupal\user\Plugin\views\access;
 
+use Drupal\Component\Utility\String;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\views\Plugin\views\access\AccessPluginBase;
 use Symfony\Component\Routing\Route;
-use Drupal\Core\Session\AccountInterface;
 
 /**
  * Access plugin that provides role-based access control.
@@ -56,7 +57,7 @@ public function summaryTitle() {
     else {
       $rids = user_role_names();
       $rid = reset($this->options['role']);
-      return check_plain($rids[$rid]);
+      return String::checkPlain($rids[$rid]);
     }
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
index d385236..1402bde 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\user\Plugin\views\argument_validator;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Database\Connection;
 use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -157,7 +158,7 @@ public function validateArgument($argument) {
     }
 
     $this->argument->argument = $account->id();
-    $this->argument->validated_title = check_plain(user_format_name($account));
+    $this->argument->validated_title = String::checkPlain(user_format_name($account));
     return TRUE;
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
index 7b189aa..7861dbc 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\user\Plugin\views\field;
 
+use Drupal\Component\Utility\String;
 use Drupal\user\Plugin\views\field\User;
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\ResultRow;
@@ -84,7 +85,7 @@ protected function renderLink($data, ResultRow $values) {
     if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
       if (!empty($this->options['overwrite_anonymous']) && !$account->id()) {
         // This is an anonymous user, and we're overriting the text.
-        return check_plain($this->options['anonymous_text']);
+        return String::checkPlain($this->options['anonymous_text']);
       }
       elseif (!empty($this->options['link_to_user'])) {
         $account->name = $this->getValue($values);
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php
index ec9df99..a355ecc 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php
@@ -7,10 +7,11 @@
 
 namespace Drupal\user\Plugin\views\field;
 
+use Drupal\Component\Utility\String;
 use Drupal\Core\Database\Connection;
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
-use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\field\PrerenderList;
+use Drupal\views\ViewExecutable;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -80,7 +81,7 @@ public function preRender(&$values) {
       $roles = user_roles();
       $result = $this->database->query('SELECT u.uid, u.rid FROM {users_roles} u WHERE u.uid IN (:uids) AND u.rid IN (:rids)', array(':uids' => $uids, ':rids' => array_keys($roles)));
       foreach ($result as $role) {
-        $this->items[$role->uid][$role->rid]['role'] = check_plain($roles[$role->rid]->label());
+        $this->items[$role->uid][$role->rid]['role'] = String::checkPlain($roles[$role->rid]->label());
         $this->items[$role->uid][$role->rid]['rid'] = $role->rid;
       }
       // Sort the roles for each user by role weight.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php
index de8062e..d205b51 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\user\Tests;
 
+use Drupal\Component\Utility\String;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -53,7 +54,7 @@ function testUserAutocomplete() {
     // Test that anonymous username is in the result when requested and escaped
     // with check_plain().
     $users = $this->drupalGetJSON('user/autocomplete/anonymous', array('query' => array('q' => drupal_substr($anonymous_name, 0, 4))));
-    $this->assertEqual(check_plain($anonymous_name), $users[0]['label'], 'The anonymous name found in autocompletion results.');
+    $this->assertEqual(String::checkPlain($anonymous_name), $users[0]['label'], 'The anonymous name found in autocompletion results.');
     $users = $this->drupalGetJSON('user/autocomplete', array('query' => array('q' => drupal_substr($anonymous_name, 0, 4))));
     $this->assertTrue(empty($users), 'The anonymous name not found in autocompletion results without enabling anonymous username.');
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
index cc706ba..a99b4fb 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
@@ -7,8 +7,9 @@
 
 namespace Drupal\user\Tests;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Component\Utility\String;
 use Drupal\Core\Language\Language;
+use Drupal\simpletest\WebTestBase;
 
 /**
  * Test user token replacement in strings.
@@ -62,15 +63,15 @@ function testUserTokenReplacement() {
     // Generate and test sanitized tokens.
     $tests = array();
     $tests['[user:uid]'] = $account->id();
-    $tests['[user:name]'] = check_plain(user_format_name($account));
-    $tests['[user:mail]'] = check_plain($account->getEmail());
+    $tests['[user:name]'] = String::checkPlain(user_format_name($account));
+    $tests['[user:mail]'] = String::checkPlain($account->getEmail());
     $tests['[user:url]'] = url("user/" . $account->id(), $url_options);
     $tests['[user:edit-url]'] = url("user/" . $account->id() . "/edit", $url_options);
     $tests['[user:last-login]'] = format_date($account->getLastLoginTime(), 'medium', '', NULL, $language_interface->id);
     $tests['[user:last-login:short]'] = format_date($account->getLastLoginTime(), 'short', '', NULL, $language_interface->id);
     $tests['[user:created]'] = format_date($account->getCreatedTime(), 'medium', '', NULL, $language_interface->id);
     $tests['[user:created:short]'] = format_date($account->getCreatedTime(), 'short', '', NULL, $language_interface->id);
-    $tests['[current-user:name]'] = check_plain(user_format_name($global_account));
+    $tests['[current-user:name]'] = String::checkPlain(user_format_name($global_account));
 
     // Test to make sure that we generated something for each token.
     $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 15d232d5..2883e40 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -19,6 +19,8 @@
  * Enables the user registration and login system.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Maximum length of username text field.
  */
@@ -623,7 +625,7 @@ function template_preprocess_username(&$variables) {
   if (drupal_strlen($name) > 20) {
     $name = drupal_substr($name, 0, 15) . '...';
   }
-  $variables['name'] = check_plain($name);
+  $variables['name'] = String::checkPlain($name);
   $variables['profile_access'] = \Drupal::currentUser()->hasPermission('access user profiles');
 
   // Populate link path and attributes if appropriate.
diff --git a/core/modules/user/user.tokens.inc b/core/modules/user/user.tokens.inc
index 5412a38..bd8d841 100644
--- a/core/modules/user/user.tokens.inc
+++ b/core/modules/user/user.tokens.inc
@@ -5,6 +5,8 @@
  * Builds placeholder replacement tokens for user-related data.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Implements hook_token_info().
  */
@@ -88,11 +90,11 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
 
         case 'name':
           $name = user_format_name($account);
-          $replacements[$original] = $sanitize ? check_plain($name) : $name;
+          $replacements[$original] = $sanitize ? String::checkPlain($name) : $name;
           break;
 
         case 'mail':
-          $replacements[$original] = $sanitize ? check_plain($account->getEmail()) : $account->getEmail();
+          $replacements[$original] = $sanitize ? String::checkPlain($account->getEmail()) : $account->getEmail();
           break;
 
         case 'url':
diff --git a/core/modules/xmlrpc/xmlrpc.inc b/core/modules/xmlrpc/xmlrpc.inc
index 445993a..8f39217 100644
--- a/core/modules/xmlrpc/xmlrpc.inc
+++ b/core/modules/xmlrpc/xmlrpc.inc
@@ -11,6 +11,7 @@
  * This version is made available under the GNU GPL License
  */
 
+use Drupal\Component\Utility\String;
 use Guzzle\Http\Exception\BadResponseException;
 use Guzzle\Http\Exception\RequestException;
 
@@ -123,7 +124,7 @@ function xmlrpc_value_get_xml($xmlrpc_value) {
     case 'struct':
       $return = '<struct>' . "\n";
       foreach ($xmlrpc_value->data as $name => $value) {
-        $return .= "  <member><name>" . check_plain($name) . "</name><value>";
+        $return .= "  <member><name>" . String::checkPlain($name) . "</name><value>";
         $return .= xmlrpc_value_get_xml($value) . "</value></member>\n";
       }
       $return .= '</struct>';
