emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-babel, python, encoding and table


From: Eric Schulte
Subject: Re: [O] org-babel, python, encoding and table
Date: Tue, 07 May 2013 14:18:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Andreas Röhler <address@hidden> writes:

> Am 07.05.2013 18:41, schrieb Eric Schulte:
>>> #+NAME: test2
>>> #+begin_src python :results value :preamble # -*- coding: utf-8 -*- :return
>>> a
>>> a = ( ( "é", "a" ), ( "a", "à" ) )
>>> b = "é"
>>> #+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 strange.
>

I think this may be a problem with the Python code.  The snippet above
expands to the following python.

# -*- coding: utf-8 -*-

def main():
        a = ( ( "é", "a" ), ( "a", "à" ) )
        b = "é"
        return a

open('/tmp/output', 'w').write( str(main()) )
which, when executed returns the following raw string (which is then
interpreted by Org-mode).

(('\xc3\xa9', 'a'), ('a', '\xc3\xa0'))
Maybe Python simply needs to be convinced to print in utf-8 format?

>
> Andreas
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

reply via email to

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