By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,002 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,002 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

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

Should setting those environment variables give me a
sys.stdout.encoding 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 getdefaultlocale() or sys.stdout.encoding.

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?


Mar 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.