refactor keyEncoding and valueEncoding
Merge pull request #78 from rvagg/refactor-encodings

refactor keyEncoding and valueEncoding