catch encoding errors