diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php
index 06c5dc2..b87b4b4 100644
--- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php
+++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php
@@ -407,7 +407,7 @@ protected function catchException(\Exception $e, $table_name = NULL) {
    */
   protected function normalizeCid($cid) {
     // Nothing to do if the ID is a US ASCII string of 255 characters or less.
-    $cid_is_ascii = mb_check_encoding($cid, 'ASCII');
+    $cid_is_ascii = preg_match('/^[[:ascii:]]+$/', $cid);
     if (strlen($cid) <= 255 && $cid_is_ascii) {
       return $cid;
     }
