그누보드를 utf-8 로 쓰다가 글자수로 자르기 함수때문에 잘린부분이 깨져서,,
질문드립니다.
[code:1]// 한글 한글자(2byte)는 길이 2, 공란.영숫자.특수문자는 길이 1
function cut_str($str, $len, $suffix="…")
{
$s = substr($str, 0, $len);
$cnt = 0;
for ($i=0; $i<strlen($s); $i++)
if (ord($s[$i]) > 127)
$cnt++;
$s = substr($s, 0, $len - ($cnt % 2));
if (strlen($s) >= strlen($str))