How to fix special characters when the title or excerpt is shortened [closed]

You can use mb_substr(), which is safe to use on multibyte strings. I ran a quick test on my local installation of PHP:

php > $str="éééééé";
php > var_dump( substr( $str, 0, 3 ) );
string(3) "é�"
php > var_dump( mb_substr( $str, 0, 3 ) );
string(6) "ééé"
php > var_dump( mb_substr( 'abcdef', 0, 3 );
string(3) "abc"