emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-babel, python, encoding and table
Date: Tue, 07 May 2013 14:18:52 -0400	[thread overview]
Message-ID: <87d2t2slf7.fsf@gmail.com> (raw)
In-Reply-To: <51893B1C.50609@easy-emacs.de> ("Andreas Röhler"'s message of "Tue, 07 May 2013 19:34:20 +0200")

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]

Andreas Röhler <andreas.roehler@easy-emacs.de> 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.


[-- Attachment #2: print.py --]
[-- Type: text/x-python, Size: 150 bytes --]

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

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

open('/tmp/output', 'w').write( str(main()) )

[-- Attachment #3: Type: text/plain, Size: 97 bytes --]


which, when executed returns the following raw string (which is then
interpreted by Org-mode).


[-- Attachment #4: output --]
[-- Type: text/plain, Size: 38 bytes --]

(('\xc3\xa9', 'a'), ('a', '\xc3\xa0'))

[-- Attachment #5: Type: text/plain, Size: 132 bytes --]


Maybe Python simply needs to be convinced to print in utf-8 format?

>
> Andreas
>
>

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

  reply	other threads:[~2013-05-07 18:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07 12:55 org-babel, python, encoding and table Roland Donat
2013-05-07 16:41 ` Eric Schulte
2013-05-07 17:34   ` Andreas Röhler
2013-05-07 18:18     ` Eric Schulte [this message]
2013-05-07 18:45       ` Andreas Röhler
2013-05-07 19:20         ` Nick Dokos
2013-05-07 19:40           ` Andreas Röhler
2013-05-07 20:05             ` Nick Dokos
2013-05-08  6:21               ` Andreas Röhler
2013-05-07 19:44           ` Roland Donat
2013-05-07 19:52             ` Andreas Röhler
2013-05-08  8:36   ` Andreas Röhler
2013-05-29 12:18     ` Roland DONAT
2013-05-29 13:00       ` Eric Schulte
2013-05-29 23:54         ` Christian Wittern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2t2slf7.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=andreas.roehler@easy-emacs.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).