]> git.mxchange.org Git - friendica.git/commitdiff
Add support for Unicode in Model\Tag::store
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Dec 2020 06:29:51 +0000 (01:29 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 24 Dec 2020 10:09:38 +0000 (05:09 -0500)
src/Model/Tag.php

index fb7f05ad7fb5983d14ae6ea09f924eb3d704504a..8ffb5b64f88957461c17ec32962b2352494e52c9 100644 (file)
@@ -70,8 +70,8 @@ class Tag
        public static function store(int $uriid, int $type, string $name, string $url = '', $probing = true)
        {
                if ($type == self::HASHTAG) {
-                       // Remove some common "garbarge" from tags
-                       $name = trim($name, "\x00..\x20\xFF#!@,;.:'/?!^°$%".'"');
+                       // Trim Unicode non-word characters
+                       $name = preg_replace('/(^\W+)|(\W+$)/us', '', $name);
 
                        $tags = explode(self::TAG_CHARACTER[self::HASHTAG], $name);
                        if (count($tags) > 1) {