doc for Encode