Fix for #304: test for `str`, not `"utf-8"`.

The code wants to produce a `str` object for the given Python version (which is the right thing to do here).