Implement 'encode' and 'decode' options.