php wordwrap cut parameter when dealing with weird characters
问题 I have a problem when using the wordwrap() function in php with for example chinese characters. When the $cut parameter in the wordwrap function is set to true, it ruins the string by inserting question marks. Is there a solution to this? 回答1: The native wordwrap function is not safe to use for unicode. Here's a mb_wordwrap by Sam B.: <?php /** * Multibyte capable wordwrap * * @param string $str * @param int $width * @param string $break * @return string */ function mb_wordwrap($str, $width