From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: Babel, Python and UTF-8 Date: Thu, 02 Dec 2010 07:29:24 -0700 Message-ID: <87mxoo9r95.fsf@gmail.com> References: <87fwuhas6t.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=39696 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POAHG-0001iX-Kk for emacs-orgmode@gnu.org; Thu, 02 Dec 2010 09:37:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1POAGM-0005U7-98 for emacs-orgmode@gnu.org; Thu, 02 Dec 2010 09:36:45 -0500 Received: from mail-yx0-f169.google.com ([209.85.213.169]:33927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1POAGM-0005Tp-6p for emacs-orgmode@gnu.org; Thu, 02 Dec 2010 09:35:58 -0500 Received: by yxl31 with SMTP id 31so18645707yxl.0 for ; Thu, 02 Dec 2010 06:35:57 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Vincent Beffara Cc: emacs-orgmode@gnu.org Hi, I've just pushed up a new prefix header argument. This header argument only has meaning for python code blocks (since it is tied into evaluation each language would have to handle it separately). This is only used during external evaluation (i.e. not when :session is specified) and the value of the :prefix argument is prepended to the temporary file evaluated by python. The following demonstrate its usage: ** Python requires a utf-8 coding prefix #+begin_src python :prefix # -*- coding: utf-8 -*- :return s s =3D "=C3=A9" #+end_src #+results: : =C3=A9 #+begin_src python :prefix # -*- coding: utf-8 -*- :results output s =3D "=C3=A9" print(s) #+end_src #+results: : =C3=A9 Best -- Eric Vincent Beffara writes: > Hi, > >> I would suggest just trying it out first and seeing if you get an error >> without such a line. > > Well, I do, that's why I'm asking ;-) > >> Also, you could try adding the line to the beginning of your code >> block. > > I tried like this : > > #+begin_src python > # -*- coding: utf-8 -*- > s =3D "=C3=A9" > #+end_src > > The error message tells me that the error happens on line 4, hence the > coding line ends up on line 3, and python only takes it into account if > it is one of the first two ... so it almost works, but it doesn't. > >> If there is definitely a problem please reply to this thread and we >> could easily add a header argument for this case, possibly named >> ":prefix" which could be used to specify such a code-block-prefix for >> code evaluation. This header argument could then be set globally or on >> the file, heading, or code block level. > > That would be fantastic ! (And possibly useful in other cases as well > ...) > > Thanks, > > /vincent > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode