diff --git a/src/AutoEntityLabelManager.php b/src/AutoEntityLabelManager.php
index c267e31..16835e0 100644
--- a/src/AutoEntityLabelManager.php
+++ b/src/AutoEntityLabelManager.php
@@ -147,6 +147,11 @@ class AutoEntityLabelManager implements AutoEntityLabelManagerInterface {
       $label = $this->getAlternativeLabel();
     }
 
+    // Escape special characters.
+    if ($this->getConfig('escape')) {
+      $label = preg_replace('/[^a-zA-Z0-9\s]/', '', strip_tags(html_entity_decode($label)));
+    }
+
     $label = substr($label, 0, 255);
     $label_name = $this->getLabelName();
     $this->entity->$label_name->setValue($label);
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);
