We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 984f630 commit 875565bCopy full SHA for 875565b
Lib/pydoc.py
@@ -209,7 +209,9 @@ def _encode(text, encoding=None):
209
def _binstr(obj):
210
# Ensure that we have an encoded (binary) string representation of obj,
211
# even if it is a unicode string.
212
- return obj.encode(_encoding) if isinstance(obj, _unicode) else str(obj)
+ if isinstance(obj, _unicode):
213
+ return obj.encode(_encoding, 'xmlcharrefreplace')
214
+ return str(obj)
215
216
# ----------------------------------------------------- module manipulation
217
0 commit comments