From 295e2bde565d9f057c4b6c3f5e4a9ae4195ede26 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 23 Feb 2011 16:37:55 -0800 Subject: [PATCH] Unicodize a couple regexes for tags: fixes linking & detection of non-ASCII tags that match the current regexes. (Checks for 'letter' and 'number' characters, underscore, dash, and period.) --- classes/Notice.php | 2 +- lib/util.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index c9cca8a969..a640919094 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -153,7 +153,7 @@ class Notice extends Memcached_DataObject function saveTags() { /* extract all #hastags */ - $count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/', strtolower($this->content), $match); + $count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/u', strtolower($this->content), $match); if (!$count) { return true; } diff --git a/lib/util.php b/lib/util.php index 85f49e4c59..b710a4391b 100644 --- a/lib/util.php +++ b/lib/util.php @@ -784,7 +784,7 @@ function common_render_text($text) $r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r); $r = common_replace_urls_callback($r, 'common_linkify'); - $r = preg_replace('/(^|\"\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r); + $r = preg_replace('/(^|\"\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/ue', "'\\1#'.common_tag_link('\\2')", $r); // XXX: machine tags return $r; } -- 2.39.2