encode data