Add Encode helper

Replacement for https://github.com/interagent/pliny-template/pull/126

Pull Request for template: https://github.com/interagent/pliny-template/pull/132
:+1:! thoughts @brandur ?