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

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

Re: python mode shell and unicode


From: Andreas Röhler
Subject: Re: python mode shell and unicode
Date: Sun, 28 Mar 2010 16:56:49 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Max Arnold wrote:
> On Sun, Mar 28, 2010 at 09:25:02AM +0200, Andreas Röhler wrote:
>> 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?
> 
> I think this is unrelated to the issue because my python code contains no
> unicode characters; they are received from parsed web page and then printed
> to stdout. The problem is with python process spawned by Emacs - its stdout
> encoding is not specified (sys.stdout.encoding is None).
> 
> Maybe this is a python feature: 
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=415968
> 
> But then I do not understand why manually invoked pyton-shell handles unicode
> characters just fine...

Looks like your problem is rather on the python than the emacs side.

If I change the function in the bugreport given above into

def output(s):
    # print s.decode('utf-8')
    print s

redirecting into FILE with > works


> 
>> You could try `py-execute-file' from python-mode.el
> 
> Sorry, didn't mentioned that I use python.el shipped with emacs. How to 
> disable
> built-in one and enable python-mode.el? 

Download it here

http://launchpad.net/python-mode/trunk/5.1.0/+download/python-mode.el

and get it loaded

 How to invoke py-execute-file from
> M-x prompt?

Just

M-x py-execute-file

should do it

Andreas

> 
> BTW, print u'\xA9' is a nice test for this issue.
> 
> Cheers, Max
> 
> 
> 





reply via email to

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