test encode index