for encode