encode output