UTF8 and substr

If you break a string using substr and it is a UTF8 string you may see � in your output. To fix this use mb_substr. mb_substr performs a multi-byte safe substr()