diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php
index 06c5dc2..e99cce9 100644
--- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php
+++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php
@@ -407,7 +407,12 @@ 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');
+    if (function_exists('mb_check_encoding')) {
+      $cid_is_ascii = mb_check_encoding($cid, 'ASCII');
+    }
+    else {
+      $cid_is_ascii = preg_match('/^[[:ascii:]]+$/', $cid);
+    }
     if (strlen($cid) <= 255 && $cid_is_ascii) {
       return $cid;
     }
