We use umlaut in our docstrings and when we use the help() function to extract the documentation, the function reports an error: UnicodeEncodeError: 'ascii' codec can't encode character.... Our docstrings are specified as unicode literals and the source file contains the line: # -*- coding: utf-8 -*- just import the module and make: help(tudelut.tudelut)
Confirmed. With Python 2: >>> import pydoc >>> pydoc.pipepager(u'tütdelüt\n', 'cat') Traceback (most recent call last): File "", line 1, in File "./Lib/pydoc.py", line 1357, in pipepager pipe.write(text) UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 1: ordinal not in range(128) With Python 3: >>> import pydoc >>> pydoc.pipepager('tütdelüt\n', 'cat') tütdelüt
The unicode text is sent to the subprocess without encoding. It is encoded implicitly to ASCII (sys.getdefaultencoding()). This patch performs explicit encoding. Tests added.