Use mb_strlen()
, not strlen()
.
The same with mb_substr()
and substr()
: Your title contains multi-byte characters, but strlen()
and substr()
do not work on characters, they work on single bytes.
For a improved function to shorten strings see this answer.