diff --git a/include/class_msgPool.inc b/include/class_msgPool.inc
index 7c621b3a6177feff189ff6882085b43e48d3ab1a..a691a6ca8c45e2bc3faa8fbc19323a622397f28a 100644
--- a/include/class_msgPool.inc
+++ b/include/class_msgPool.inc
@@ -418,46 +418,25 @@ class msgPool
   }
 
   /*!
-   * \brief Display error about invalid characters
+   * \brief Return error about invalid value
    *
    * \param string $name The field name
    *
    * \param string $data The submited data
    *
-   * \param string $regex
-   *
    * \param string $example Example of a right submited data
    */
-  public static function invalid ($name, $data = "", $regex = "", $example = "")
+  public static function invalid (string $name, string $data = '', string $example = ''): string
   {
-    /* Stylize example */
-    if ($example != "") {
-      $example = "<br><br><i>"._("Example:")."</i> ".$example;
-    }
-
-    /* If validChars are posted, take data and paint all invalid
-       characters... */
-    if ($regex) {
-      $result   = "";
-      $mismatch = "";
-
-      mb_internal_encoding('UTF-8');
-      for ($i = 0; $i <= mb_strlen($data); $i++) {
-        $currentChar = mb_substr($data, $i, 1);
-        if (preg_match("$regex", $currentChar)) {
-          $result .= $currentChar;
-        } else {
-          $result   .= '<span style="color:red;text-decoration:underline;">'.($currentChar).'</span>';
-          $mismatch .= $currentChar;
-        }
-      }
+    $error = sprintf(_('The field "%s" contains an invalid value.'), htmlentities($name, ENT_COMPAT, 'UTF-8'));
+    $error .= '<br/><br/> "'.htmlentities($data, ENT_COMPAT, 'UTF-8').'"';
 
-      return sprintf(_("The field '%s' contains invalid characters"), $name).". ".
-        ((strlen($mismatch) == 1) ? sprintf(_("'%s' is not allowed:"), $mismatch) : sprintf(_("'%s' are not allowed!"), $mismatch)).
-        "<br><br> \"$result\"$example";
-    } else {
-      return sprintf(_("The field '%s' contains invalid characters"), $name)."!$example";
+    /* Stylize example */
+    if ($example !== '') {
+      $error .= '<br/><br/><i>'.sprintf(_('Example: %s'), htmlentities($example, ENT_COMPAT, 'UTF-8')).'</i> ';
     }
+
+    return $error;
   }
 
   /*!
diff --git a/include/simpleplugin/attributes/class_IntAttribute.inc b/include/simpleplugin/attributes/class_IntAttribute.inc
index 83f7a8c25a9adc821f2bda338d0971529153d5b5..496c7cd105e27234251125d7bebb58b6975c9cd5 100644
--- a/include/simpleplugin/attributes/class_IntAttribute.inc
+++ b/include/simpleplugin/attributes/class_IntAttribute.inc
@@ -1,7 +1,7 @@
 <?php
 /*
   This code is part of FusionDirectory (http://www.fusiondirectory.org/)
-  Copyright (C) 2012-2016  FusionDirectory
+  Copyright (C) 2012-2019  FusionDirectory
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -44,14 +44,14 @@ class IntAttribute extends Attribute
     parent::__construct($label, $description, $ldapName, $required, $defaultValue, $acl);
     $this->min      = ($min === FALSE ? FALSE : $this->inputValue($min));
     $this->max      = ($max === FALSE ? FALSE : $this->inputValue($max));
-    $this->example  = "";
+    $this->example  = '';
 
     if (($min !== FALSE) && ($max !== FALSE)) {
-      $this->example = sprintf(_("An integer between %d and %d"), $min, $max);
+      $this->example = sprintf(_('An integer between %d and %d'), $min, $max);
     } elseif ($min !== FALSE) {
-      $this->example = sprintf(_("An integer larger than %d"),    $min);
+      $this->example = sprintf(_('An integer larger than %d'),    $min);
     } elseif ($max !== FALSE) {
-      $this->example = sprintf(_("An integer smaller than %d"),   $max);
+      $this->example = sprintf(_('An integer smaller than %d'),   $max);
     }
   }
 
@@ -80,11 +80,11 @@ class IntAttribute extends Attribute
       return $error;
     } elseif ($this->value !== '') {
       if (!is_numeric($this->value)) {
-        return msgPool::invalid($this->getLabel(), $this->value, "/./", $this->example);
+        return msgPool::invalid($this->getLabel(), $this->value, $this->example);
       }
       if ((($this->min !== FALSE) && ($this->value < $this->min))
       || (($this->max !== FALSE) && ($this->value > $this->max))) {
-        return msgPool::invalid($this->getLabel(), $this->value, "/./", $this->example);
+        return msgPool::invalid($this->getLabel(), $this->value, $this->example);
       }
     }
   }
@@ -157,13 +157,13 @@ class FloatAttribute extends IntAttribute
 
     $this->step = 0.01;
 
-    $this->example  = "";
+    $this->example  = '';
     if (($min !== FALSE) && ($max !== FALSE)) {
-      $this->example = sprintf(_("A float between %f and %f"), $min, $max);
+      $this->example = sprintf(_('A float between %f and %f'), $min, $max);
     } elseif ($min !== FALSE) {
-      $this->example = sprintf(_("A float larger than %f"),    $min);
+      $this->example = sprintf(_('A float larger than %f'),    $min);
     } elseif ($max !== FALSE) {
-      $this->example = sprintf(_("A float smaller than %f"),   $max);
+      $this->example = sprintf(_('A float smaller than %f'),   $max);
     }
   }
 
diff --git a/include/simpleplugin/attributes/class_StringAttribute.inc b/include/simpleplugin/attributes/class_StringAttribute.inc
index 3d4ed21cda82f69f8a53950faa14bab2d55b379c..635de25fd1883260e8825fc09d686cd58437027c 100644
--- a/include/simpleplugin/attributes/class_StringAttribute.inc
+++ b/include/simpleplugin/attributes/class_StringAttribute.inc
@@ -127,8 +127,8 @@ class StringAttribute extends Attribute
 
   function validate ()
   {
-    if (($this->pattern !== "") && !preg_match($this->pattern, $this->value)) {
-      return msgPool::invalid($this->getLabel(), $this->value, $this->pattern, htmlentities($this->example));
+    if (($this->pattern !== '') && !preg_match($this->pattern, $this->value)) {
+      return msgPool::invalid($this->getLabel(), $this->value, $this->example);
     }
   }
 
diff --git a/include/simpleplugin/class_helpersAttribute.inc b/include/simpleplugin/class_helpersAttribute.inc
index 4574d8faa68b9e2a819e21c1df27515ad734652f..28829a54cfc133638f86f70c87221235e8389ccf 100644
--- a/include/simpleplugin/class_helpersAttribute.inc
+++ b/include/simpleplugin/class_helpersAttribute.inc
@@ -30,7 +30,7 @@ class TestValidateAttribute extends StringAttribute
   {
     $func = $this->testFunc;
     if (!tests::$func($this->value)) {
-      return msgPool::invalid($this->getLabel(), $this->value);
+      return msgPool::invalid($this->getLabel(), $this->value, $this->example);
     }
   }
 }