Detect the character encoding of the docstring only if it fails to render it

Formerly, if using Python 2.x and docstrings contain non-ascii characters, rendering has failed due to UnicodeDecodeError. I solved it to decode the docstring in that case, with the encoding of the module that contains the docstring.

More details are included in the diff.