fix UTF-8 encoding error by ignoring bad encodings