help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

python-shell-send-region uses wrong encoding?


From: Ernest Adrogué
Subject: python-shell-send-region uses wrong encoding?
Date: Tue, 29 Oct 2013 12:30:44 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Hi there,

I have got a problem with python-shell-send-region. It seems to use a wrong
encoding. For example, I have this file:

$ cat /tmp/test.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function

a = 'Wörterbuch'.decode('utf8')
b = u'Wörterbuch'

print(repr(a))
print(repr(b))
$ 

When I open the file with Emacs and do python-shell-send-buffer (C-c C-c by
default) the following lines appear in the shell buffer:

u'W\xf6rterbuch'
u'W\xf6rterbuch'

This is the same output that I get when I run the script in a terminal.
However, if I select the lines after 'from __future__ ...' until the end and
do python-shell-send-region (C-c C-r) I get this output instead:

u'W\xf6rterbuch'
u'W\xc3\xb6rterbuch'

The second line of output seems to indicate that the text was sent in a
different encoding compared to python-shell-send-buffer.

What is going on?

Regards.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]