Add test for Encoding interface and corresponding patch

Special-case handling of the Encoding interface was missing the length-delimiter in the encoding.