From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: org-babel, python, encoding and table Date: Tue, 07 May 2013 14:18:52 -0400 Message-ID: <87d2t2slf7.fsf@gmail.com> References: <87zjw6spxt.fsf@gmail.com> <51893B1C.50609@easy-emacs.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:49333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZmTb-0006Nz-3O for emacs-orgmode@gnu.org; Tue, 07 May 2013 14:19:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZmTZ-00042o-PO for emacs-orgmode@gnu.org; Tue, 07 May 2013 14:18:59 -0400 Received: from mail-ve0-x230.google.com ([2607:f8b0:400c:c01::230]:54712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZmTZ-00042c-Kz for emacs-orgmode@gnu.org; Tue, 07 May 2013 14:18:57 -0400 Received: by mail-ve0-f176.google.com with SMTP id cz11so887295veb.21 for ; Tue, 07 May 2013 11:18:57 -0700 (PDT) In-Reply-To: <51893B1C.50609@easy-emacs.de> ("Andreas =?utf-8?Q?R=C3=B6hle?= =?utf-8?Q?r=22's?= message of "Tue, 07 May 2013 19:34:20 +0200") 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: Andreas =?utf-8?Q?R=C3=B6hler?= Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Andreas R=C3=B6hler writes: > Am 07.05.2013 18:41, schrieb Eric Schulte: >>> #+NAME: test2 >>> #+begin_src python :results value :preamble # -*- coding: utf-8 -*- :re= turn >>> a >>> a =3D ( ( "=C3=A9", "a" ), ( "a", "=C3=A0" ) ) >>> b =3D "=C3=A9" >>> #+end_src >>> >>> #+RESULTS: test2 >>> | \303\251 | a | >>> | a | \303\240 | >>> >> >> Maybe this isn't an execution problem, but is rather a buffer encoding >> problem. I executed your example above in a small buffer (attached). I >> then saved this buffer and was forced to specify an encoding, I selected >> utf8. If I cat the resulting file from disk, the accented characters >> appear correctly. >> >> >> >> >> So maybe the problem is simply Emacs not displaying utf8 characters >> correctly. >> >> Hope this helps, >> > > Here error occurs depending if a or b is specified for return, really str= ange. > I think this may be a problem with the Python code. The snippet above expands to the following python. --=-=-= Content-Type: text/x-python; charset=utf-8 Content-Disposition: inline; filename=print.py Content-Transfer-Encoding: quoted-printable # -*- coding: utf-8 -*- def main(): a =3D ( ( "=C3=A9", "a" ), ( "a", "=C3=A0" ) ) b =3D "=C3=A9" return a open('/tmp/output', 'w').write( str(main()) ) --=-=-= Content-Type: text/plain which, when executed returns the following raw string (which is then interpreted by Org-mode). --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=output (('\xc3\xa9', 'a'), ('a', '\xc3\xa0')) --=-=-= Content-Type: text/plain Maybe Python simply needs to be convinced to print in utf-8 format? > > Andreas > > -- Eric Schulte http://cs.unm.edu/~eschulte --=-=-=--