diff --git a/src/NXP/Stemmer.php b/src/NXP/Stemmer.php index 0188434..73b993c 100644 --- a/src/NXP/Stemmer.php +++ b/src/NXP/Stemmer.php @@ -93,7 +93,7 @@ class Stemmer public static function removeEndings(&$word, $regex, $region) { $prefix = mb_substr($word, 0, $region, 'UTF-8'); - $ending = substr($word, strlen($prefix)); + $ending = mb_substr($word, mb_strlen($prefix, 'UTF-8'), null, 'UTF-8'); if (is_array($regex)) { if (preg_match('/.+[а|я]' . $regex[0] . '/ui', $ending)) { $word = $prefix . preg_replace('/' . $regex[0] . '/ui', '', $ending);