encoding and test