This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients skip.montanaro
Date 2015-02-01.19:24:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I'm probably doing something wrong, but I've tried everything I can think of
without any success.

In Python 2.7, the pydoc command successfully displays help for the sqlite3
package, though it muffs the output of Gerhard Häring's name, spitting out
the original Latin-1 spelling. In Python 3.x, I get a UnicodeEncodeError for
my trouble, and it hoses my tty settings to boot, requiring a LF reset LF
sequence to put right unless I set PAGER to "cat".

Here's a sample run:

% PAGER=cat pydoc3.5 sqlite3
Traceback (most recent call last):
  File "/Users/skip/local/bin/pydoc3.5", line 5, in <module>
  File "/Users/skip/local/lib/python3.5/", line 2591, in cli
  File "/Users/skip/local/lib/python3.5/", line 1874, in help
    elif request: doc(request, 'Help on %s:', output=self._output)
  File "/Users/skip/local/lib/python3.5/", line 1612, in doc
    pager(render_doc(thing, title, forceload))
  File "/Users/skip/local/lib/python3.5/", line 1412, in pager
  File "/Users/skip/local/lib/python3.5/", line 1428, in <lambda>
    return lambda text: pipepager(text, os.environ['PAGER'])
  File "/Users/skip/local/lib/python3.5/", line 1455, in pipepager
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 600: ordinal not in range(128)

I understand the error, but I see no way to convince it to use any codec
other than "ascii".  Stuff I tried:

* setting PYTHONIOENCODING to "UTF-8" (suggested by Peter Otten on
* setting LANG to "en_US.utf8"

This is on a Mac running Yosemite with pydoc invoked in Apple's Terminal
app. Display is fine in my browser when I run pydoc as a web server.

The source it is attempting to display has a coding cookie, so it should
know that the code is encoded using Latin-1. The problem seems to all be
about generating output.
Date User Action Args
2015-02-01 19:24:18skip.montanarosetrecipients: + skip.montanaro
2015-02-01 19:24:18skip.montanarosetmessageid: <>
2015-02-01 19:24:18skip.montanarolinkissue23374 messages
2015-02-01 19:24:18skip.montanarocreate