Open mgedmin opened 5 years ago
I'm considering self.getOutput().decode(self.response.charset or 'latin-1')
.
(The or 'latin-1'
is because for responses that return e.g. image/png, self.response.charset will be None
, and str.decode() does not like None.)
I'm porting an application to Python 3. I have some (old) functional tests like this:
The
°
is encoded in UTF-8 on disk. This works on Python 2, where everything is bytes.On Python 3 I'm getting this problem:
because
zope.app.wsgi.testlayer.FakeResponse.__str__
is defined, on Python 3, to returnMeanwhile the Python 3 doctest module defaults to interpreting doctests as being in UTF-8 if no explicit encoding has been provided.
What can we do to make things work out of the box?