Issue 7675: help() doesn't accept unicode literals in built in docstrings (original) (raw)

Created on 2010-01-11 09:40 by psd, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tudelut.py psd,2010-01-11 09:40 a small test that reproduces the error
issue7675_pydoc_v2.diff flox,2010-01-11 20:58 Patch, apply to trunk
Messages (6)
msg97584 - (view) Author: pablo stapff (psd) Date: 2010-01-11 09:40
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)
msg97585 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-11 11:07
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
msg97590 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-11 16:43
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.
msg97591 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-01-11 16:46
The patch should also work with 8-bit docstrings, and the tests should reflect both uses.
msg97604 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-11 20:53
New patch: backward compatibility preserved.
msg99720 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-02-22 11:06
It looks like a duplicate of #6625.
History
Date User Action Args
2022-04-11 14:56:56 admin set github: 51924
2010-08-01 19:42:07 flox unlink issue8994 superseder
2010-08-01 19:41:31 flox link issue8994 superseder
2010-02-22 11:06:55 flox set status: open -> closedresolution: duplicatesuperseder: UnicodeEncodeError on pydoc's CLImessages: +
2010-01-11 20:58:03 flox set files: + issue7675_pydoc_v2.diff
2010-01-11 20:57:49 flox set files: - issue7675_pydoc_v2.diff
2010-01-11 20:53:30 flox set files: + issue7675_pydoc_v2.diffmessages: +
2010-01-11 20:51:26 flox set files: - issue7675_pydoc.diff
2010-01-11 16:46:22 pitrou set nosy: + pitroumessages: +
2010-01-11 16:43:48 flox set files: + issue7675_pydoc.diffversions: + Python 3.2messages: + keywords: + patchstage: needs patch -> patch review
2010-01-11 13:09:14 ezio.melotti set nosy: + ezio.melotti
2010-01-11 11:07:58 flox set priority: normalversions: + Python 2.7nosy: + floxmessages: + stage: needs patch
2010-01-11 09:40:11 psd create