From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Wittern Subject: Re: org-babel, python, encoding and table Date: Thu, 30 May 2013 08:54:55 +0900 Message-ID: <51A6954F.1090104@gmail.com> References: <87zjw6spxt.fsf@gmail.com> <518A0E9E.7070309@easy-emacs.de> <87ehcq0wm5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhqCw-00069s-Ux for emacs-orgmode@gnu.org; Wed, 29 May 2013 19:55:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhqCq-0002wa-15 for emacs-orgmode@gnu.org; Wed, 29 May 2013 19:55:06 -0400 Received: from mail-pb0-x232.google.com ([2607:f8b0:400e:c01::232]:55637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhqCp-0002wN-Q9 for emacs-orgmode@gnu.org; Wed, 29 May 2013 19:54:59 -0400 Received: by mail-pb0-f50.google.com with SMTP id wy17so9883501pbc.23 for ; Wed, 29 May 2013 16:54:58 -0700 (PDT) Received: from mbp3.local (p24127-ipngn100401kyoto.kyoto.ocn.ne.jp. [180.10.71.127]) by mx.google.com with ESMTPSA id bs2sm41799347pad.17.2013.05.29.16.54.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 May 2013 16:54:57 -0700 (PDT) In-Reply-To: <87ehcq0wm5.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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