Revert "improve performance by only encoding when necessary"

This reverts commit f7c75423ab2b7f0a5ef0847debfabf933af7df04.