Set sys.stdout.encoding to utf8 in emacs/python-mode?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • damonwischik@gmail.com

    Set sys.stdout.encoding to utf8 in emacs/python-mode?

    I use emacs 22 and python-mode. Emacs can display utf8 characters
    (e.g. when I open a utf8-encoded file with Chinese, those characters
    show up fine), and I'd like to see utf8-encoded output from my python
    session.

    From googling, I've found references to
    * locale.getdefau ltlocale(), which is ('en_GB', 'cp1252')
    * sys.stdout.enco ding, which is None
    * the environment variables LANG, LC_CHARSET and LC_ALL.


    Should setting those environment variables give me a
    sys.stdout.enco ding of utf8? What should I set them to? I tried
    setting LANG to en_GB and LC_CHARSET to utf8, but it doesn't have the
    effect of changing getdefaultlocal e() or sys.stdout.enco ding.

    Or is there some option I can set for python-mode so that it will
    instruct the python interpreter to use utf8 for its output?

    Damon.

Working...