add testEncode