Fix issue where truncation or infinite loop might occur.

Text is truncated when calling Encoding::fixUTF8 if mb_strlen is overloading strlen. This is because mb_strlen returns the char length instead of the byte length of the string.