今更なのですが、以前feedcreator.class.php(1.7.2-ppt)を置き換えた際にマルチバイト対応が抜けていたことに気づきました。以下のように、substr()をmb_strimwidth()に置き換えれば対処できます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | function iTrunc($string, $length) { if (strlen($string)<=$length) { return $string; } $pos = strrpos($string,"."); if ($pos>=$length-4) { $string = substr($string,0,$length-4); $pos = strrpos($string,"."); } if ($pos>=$length*0.4) { return mb_strimwidth($string,0,$pos+1," ..."); #return substr($string,0,$pos+1)." ..."; } $pos = strrpos($string," "); if ($pos>=$length-4) { $string = substr($string,0,$length-4); $pos = strrpos($string," "); } if ($pos>=$length*0.4) { return mb_strimwidth($string,0,$pos," ..."); #return substr($string,0,$pos)." ..."; } return mb_strimwidth($string,0,$length-4," ..."); #return substr($string,0,$length-4)." ..."; } |