diff --git a/components/ILIAS/Form/classes/class.ilTextAreaInputGUI.php b/components/ILIAS/Form/classes/class.ilTextAreaInputGUI.php index 2fca91a422ad..aa4833080d7c 100755 --- a/components/ILIAS/Form/classes/class.ilTextAreaInputGUI.php +++ b/components/ILIAS/Form/classes/class.ilTextAreaInputGUI.php @@ -269,15 +269,7 @@ public function checkInput(): bool } if ($this->isCharLimited()) { - //avoid whitespace surprises. #20630, #20674 - $ascii_whitespaces = chr(194) . chr(160); - $ascii_breaklines = chr(13) . chr(10); - - $to_replace = array($ascii_whitespaces, $ascii_breaklines, "<", ">", "&"); - $replace_to = array(' ', '', "_", "_", "_"); - - #20630 mbstring extension is mandatory for 5.4 - $chars_entered = mb_strlen(strip_tags(str_replace($to_replace, $replace_to, $value))); + $chars_entered = mb_strlen($value); if ($this->getMaxNumOfChars() && ($chars_entered > $this->getMaxNumOfChars())) { $this->setAlert($lng->txt("msg_input_char_limit_max")); @@ -306,6 +298,10 @@ public function getInput(): string } $value = self::removeProhibitedCharacters($value); + + # Convert newline characters + $value = str_replace("\r\n", "\n", $value); + return $value; }