From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Babel, Python and UTF-8 Date: Thu, 02 Dec 2010 18:23:49 +0000 Message-ID: <87oc94f2yy.fsf@gmail.com> References: <87fwuhas6t.fsf@gmail.com> <87mxoo9r95.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=52673 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PODp6-0000QR-VS for emacs-orgmode@gnu.org; Thu, 02 Dec 2010 13:24:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PODp3-00083I-Qh for emacs-orgmode@gnu.org; Thu, 02 Dec 2010 13:24:04 -0500 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:34312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PODp3-00082r-Gd for emacs-orgmode@gnu.org; Thu, 02 Dec 2010 13:24:01 -0500 In-Reply-To: <87mxoo9r95.fsf@gmail.com> (Eric Schulte's message of "Thu, 02 Dec 2010 07:29:24 -0700") 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: Eric Schulte Cc: Vincent Beffara , emacs-orgmode@gnu.org "Eric Schulte" writes: > Hi, > > I've just pushed up a new prefix header argument. "preamble" might be a better name? or "header"? prefix makes me think of adding a string onto the front of a string[1]; preamble and header are used by e.g. latex to refer to prelimary lines at the top of a file. For obscure options like this it might be OK to use a longer name (e.g. ":header-line"), especially now we have multiline header args with #+header. > This header argument > only has meaning for python code blocks but might in the future be used by others? Dan [1]: accurate i know, but many people won't think of a block as a character string. > (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 "=E9" > #+end_src > > #+results: > : =C3=A9 > > #+begin_src python :prefix # -*- coding: utf-8 -*- :results output > s =3D "=E9" > 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 err= or >>> 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 i= f >> 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 > > _______________________________________________ > 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