changeset: 88316:e57660acc6d4 branch: 2.7 user: R David Murray date: Sun Jan 05 17:14:08 2014 -0500 files: Lib/pydoc.py description: #1065986: add missing error handler in pydoc unicode fix. diff -r bf077fc97fdd -r e57660acc6d4 Lib/pydoc.py --- a/Lib/pydoc.py Sun Jan 05 12:35:59 2014 -0500 +++ b/Lib/pydoc.py Sun Jan 05 17:14:08 2014 -0500 @@ -209,7 +209,9 @@ def _binstr(obj): # Ensure that we have an encoded (binary) string representation of obj, # even if it is a unicode string. - return obj.encode(_encoding) if isinstance(obj, _unicode) else str(obj) + if isinstance(obj, _unicode): + return obj.encode(_encoding, 'xmlcharrefreplace') + return str(obj) # ----------------------------------------------------- module manipulation