Replaced strlen to mb_strlen, substr to mb_substr.