[issue21398] LC_CTYPE=C: pydoc leaves terminal in an unusable state

STINNER Victor report at bugs.python.org
Fri May 2 21:39:18 CEST 2014


STINNER Victor added the comment:

heapq documentation contains "François" which is not encodable to ASCII. When using LC_ALL=C, the locale encoding is ASCII (at least on Linux). It's not easy to specify a different error handler globally in pydoc, different functions are used and child processes are spawned. The subprocess module doesn't allow to specify an error handler different than strict (see #6135).

I propose pydoc_encoding.patch which escapes manually non-encodable characters. I chose sys.getfilesystemencoding(), I'm not sure that it's the encoding used for all cases of getpager() on all platforms. For example, on Windows, sys.getfilesystemencoding() is the ANSI code page, whereas sys.stdout.encoding is the OEM code page.

----------
keywords: +patch
Added file: http://bugs.python.org/file35132/pydoc_encoding.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21398>
_______________________________________


More information about the Python-bugs-list mailing list