Provide rescue clause for invalid encoding