[Python-mode] python mode shell and unicode

Andreas Röhler andreas.roehler at easy-emacs.de
Sun Mar 28 09:25:02 CEST 2010


Max Arnold wrote:
> On Sat, Mar 27, 2010 at 06:48:00PM +0100, Andreas Röhler wrote:
>>> My python-shell invoked via C-c C-c from python buffer can not print unicode characters (emits
>>> UnicodeEncodeError) and sys.stdout.encoding is empty. System wide LANG set to "ru_RU.UTF-8" and
>>> os.environ.get('LANG') in python shell confirms this.
>>>
>>> When python-shell invoked manually (M-x python-shell) there is no encoding issues. Any ideas?
>>>
>> What you get from
>> C-h v buffer-file-coding-system?
> 
> ---
> buffer-file-coding-system is a variable defined in `C source code'.
> Its value is utf-8-unix
> Local in buffer test1.py; global value is utf-8-unix
> ...
> It does not apply to sending output to subprocesses, however.
> ---
> 
> Python module contains encoding specification # -*- coding: utf-8 -*- at the beginning.
> Emacs version is 23.1.
> 
> 
> 

Hmm, see inside `python-send-region'

  ;; Fixme: Write a `coding' header to the temp file if the region is
  ;; non-ASCII.

Maybe that indicates the cause?

You could try `py-execute-file' from python-mode.el

CC to mailing list there.


Andreas

--
https://code.launchpad.net/~a-roehler/python-mode
https://code.launchpad.net/s-x-emacs-werkstatt/





More information about the Python-mode mailing list