Switch later in stateful encoding encoders to prevent lots of additional bytes in error conditions.

Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=19941