summaryrefslogtreecommitdiff
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-05-17 21:05:10 -0700
committerLarry Hastings <larry@hastings.org>2014-05-17 21:05:10 -0700
commit3a260d228b32b04a88d947b887bf81759e8e5f10 (patch)
treee4a34e9cbbf877cf021ffba743ddbf54e17526b7 /Lib/pydoc.py
parent2110603344316d927e6d639275c12f5da78601d5 (diff)
parentb1a1ec3151155a1ae65831793b4a5b7a87d9d09f (diff)
downloadcpython-git-3a260d228b32b04a88d947b887bf81759e8e5f10.tar.gz
Merge.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 5f128320d2..42f48e1d63 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1404,6 +1404,9 @@ class _PlainTextDoc(TextDoc):
def pager(text):
"""The first time this is called, determine what kind of pager to use."""
global pager
+ # Escape non-encodable characters to avoid encoding errors later
+ encoding = sys.getfilesystemencoding()
+ text = text.encode(encoding, 'backslashreplace').decode(encoding)
pager = getpager()
pager(text)