From f0eeb4900f2c74bc67cbc0d6c2baae3aa556b71f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 21 Dec 2020 01:29:51 -0500 Subject: [PATCH] Add support for Unicode in Model\Tag::store --- src/Model/Tag.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Tag.php b/src/Model/Tag.php index fb7f05ad7..8ffb5b64f 100644 --- a/src/Model/Tag.php +++ b/src/Model/Tag.php @@ -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) {