Replaces invalid UTF-8 characters.