use encode interface