I have a useful function that grabs the text from the long description of products, news, etc and shows limited number of words to create news or product snapshots . Now the problem is when the long description is in Chinese, Russian, Arabic (none ASCII) this function breaks.
How can I enforce UT8 encoding into this function or is there any alternative to show limited number of words from a long description?
function wordLimit($string,$limitNum){
if (strlen($string) > $limitNum){
$string = substr($string, 0, strrpos(substr($string, 0, $limitNum), ' ')) . '...';
}
return $string;
}