change func encode to codec for pike, add a test for encode/decode