From 5becf260fafd741fd34948f12131d8074dc2b5dc Mon Sep 17 00:00:00 2001 From: lizyn Date: Tue, 25 Dec 2018 15:31:44 +0800 Subject: fix incorrect reading time calculation for entries with CJK characters --- src/Wallabag/CoreBundle/Tools/Utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Tools/Utils.php b/src/Wallabag/CoreBundle/Tools/Utils.php index 46bb1dc5..0a805210 100644 --- a/src/Wallabag/CoreBundle/Tools/Utils.php +++ b/src/Wallabag/CoreBundle/Tools/Utils.php @@ -29,6 +29,6 @@ class Utils */ public static function getReadingTime($text) { - return floor(\count(preg_split('~[^\p{L}\p{N}\']+~u', strip_tags($text))) / 200); + return floor(\count(preg_split('~([^\p{L}\p{N}\']+|\p{Han}|\p{Hiragana}|\p{Katakana}|\p{Hangul})~u', strip_tags($text))) / 200); } } -- cgit v1.2.3