diff --git a/src/AutoEntityLabelManager.php b/src/AutoEntityLabelManager.php
index c267e31..e5e84b7 100644
--- a/src/AutoEntityLabelManager.php
+++ b/src/AutoEntityLabelManager.php
@@ -268,8 +268,9 @@ class AutoEntityLabelManager implements AutoEntityLabelManagerInterface {
     // Decode HTML entities, returning them to their original UTF-8 characters.
     $output = Html::decodeEntities($output);
 
-    // Strip tags.
-    $output = preg_replace('/[\t\n\r\0\x0B]/', '', strip_tags($output));
+    // Strip tags and Escape special characters.
+    $pattern = !empty($this->getConfig('escape')) ? '/[^a-zA-Z0-9\s]|[\t\n\r\0\x0B]/' : '/[\t\n\r\0\x0B]/';
+    $output = preg_replace($pattern, '', strip_tags($output));
 
     return $output;
   }
diff --git a/src/Form/AutoEntityLabelForm.php b/src/Form/AutoEntityLabelForm.php
index a9cee45..ac00c0c 100644
--- a/src/Form/AutoEntityLabelForm.php
+++ b/src/Form/AutoEntityLabelForm.php
@@ -186,6 +186,13 @@ class AutoEntityLabelForm extends ConfigFormBase {
       '#default_value' => $config->get($key . '_php'),
     ];
 
+    $form['auto_entitylabel'][$key . '_escape'] = [
+      '#type' => 'checkbox',
+      '#title' => $this->t('Escape special characters.'),
+      '#description' => $this->t('Check this to escape all special characters.'),
+      '#default_value' => $config->get($key . '_escape'),
+    ];
+
     $form['#attached']['library'][] = 'auto_entitylabel/auto_entitylabel.admin';
 
     return parent::buildForm($form, $form_state);
