catch encoding error in plugin