the error was ``output`` being a bytestring with non-ascii characters, being "promoted" to unicode (since that's what has the encode method, also this used the default system encoding), only to encode it again.

It should have been encoded at all in this case (the new if statement in 2113)