wsgiref.handlers.py tries to send strings where bytes is necessary in accordance with PEP333 the attached patch encodes everything with ISO-8859-1. Additionally the patch from Issue 3348 has to be applied.
The test uses StringIO. I don't understand the test enough to change that. If I understand the WSGI spec correctly then it would be the test that's wrong.
The test should indeed be changed. You may want to use io.BytesIO instead. In any case this test looks like a standard usage of the library. Please make it as pleasant-looking as possible.