pir - 2011-11-08

Instead of strlen($data), call mb_strlen($data,"UTF-8").
You need to have mbstring in your phpinfo.