Handle case where encoding is not set

This was turned up by the post-merge tests in Protues: https://github.com/hashdist/hashdist/pull/228