> $i) == (0xff & 0xff00 >> $i)) { // // $i $b (binary) : The first byte of a multi-byte sequence // --------------- (See utf-8(7)) // 2 110x xxxx // : : : // 6 1111 110x // return $s; //$cutlen = 0; // To survive (all the bytes) } else { $cutlen = $i; // Otherwise it is considered BROKEN; to cut off } break; } else { // $b == 10xx xxxx (binary) : Non-ASCII, non-1st } } return substr($s, 0, $slen - $cutlen); } ?>