add test for encoding