test encode