In particular, parse bad UTF8 by replacing the broken bits with U+FFFD and resychronise correctly after broken sequences.