nose-devs/nose — pull request #686 by jszakmeister (2013-05-09 16:20:03+00:00)
Title: Fix #649: UnicodeDecodeError when an exception contains encoded strings

The issue stems from the fact that when you use a coding line in the
Python file, and raise an exception that contains unicode characters,
the message in the exception is an encoded string. We need to get it
converted into unicode, but simply calling `unicode(ev)` doesn't work,
as that often fails with a `UnicodeDecodeError` because it assumes
`ascii` encoding by default.

This fixes the issue by trying to decode the stream as UTF-8, and uses
replacement on errors. It's not ideal, but the best we can do since
we don't know the encoding of the message string.

Thanks to Christoph Zwerschke for the test case.