emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: Babel, Python and UTF-8


From: Eric Schulte
Subject: Re: [Orgmode] Re: Babel, Python and UTF-8
Date: Thu, 02 Dec 2010 07:29:24 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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 = "é"
#+end_src

#+results:
: é

#+begin_src python :prefix # -*- coding: utf-8 -*- :results output
s = "é"
print(s)
#+end_src

#+results:
: é

Best -- Eric

Vincent Beffara <address@hidden> 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 = "é"
> #+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.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

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