repair encode