Catch encoding exceptions