Allow to set encoding config for compass filter.

This is the successor of #511 including a unit test.
Unfortunately github does not update closed PRs, so it was necessary to create a new one. :-\