emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-babel, python, encoding and table


From: Christian Wittern
Subject: Re: [O] org-babel, python, encoding and table
Date: Thu, 30 May 2013 08:54:55 +0900
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 2013-05-29 22:00, Eric Schulte wrote:
This does seem to be in the right direction.  This is similar to my
diagnosis of the non-session case [1].  If the python process prints
weird hex character values (e.g., '\xc3\xa0') instead of utf8 characters
(e.g., "à"), then Babel will insert the hex values into the buffer.

As I recall switching to python3 solved this problem?
What I do regularily in my python code to force python2 into emitting utf8 characters is the following:
#+BEGIN_SRC python
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
#+END_SRC

There are other methods, for example resetting the default encoding in the site-wide file site.py, but that is not very portable.

Hope this helps,

Christian

--
Christian Wittern, Kyoto




reply via email to

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