Removing nbsp from input strings
authorAlexander Ebert <ebert@woltlab.com>
Mon, 22 Aug 2016 13:36:53 +0000 (15:36 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 22 Aug 2016 13:37:01 +0000 (15:37 +0200)
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php

index c8f8593969ff95737c8c192560c52d9b3a874552..4d6102ab3c57b0d15ebea2a21591b4811df94c68 100644 (file)
@@ -159,6 +159,11 @@ class HtmlInputNodeTextParser {
                        $node = $nodes[$i];
                        $oldValue = $value = $node->textContent;
                        
+                       // this extra step ensures we don't trip over some random
+                       // &nbsp; inserted by the editor and at the same time
+                       // gets rid of them afterwards
+                       $value = preg_replace('~\x{00A0}~u', ' ', $value);
+                       
                        if (!empty($users)) {
                                $value = $this->parseMention($node, $value, $users);
                        }