Anybody run into this problem for complex Latin characters, such as Vietnamese?
function truncate($str, $length, $append = '…') { $strLength = mb_strlen($str); if ($strLength <= $length) { return $str; } return mb_substr($str, 0, $length) . $append; } echo truncate('Bà Rịa - Vũng Tàu!', 14); outputs:
Bà Rịa - V�…
http://codepad.viper-7.com/GOZFB0
I need some help to make it cut at the character, but I'm not even sure what is going on behind the scenes here.