I have a problem with the output of org-babel code blocks when this output contains accented characters. For example, if I execute this code block:

#+name: test_accented
#+begin_src python :results output

the result is:

#+RESULTS: test_accented
: éèà

My config relating to encoding is:

;; utf-8 ;; 
(setq locale-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)

I use emacs 25.2.2, org-mode 9.2.3 and python 3.6.7. I also tried with another language (ruby) and the result is the same.

  • I'm not able to reproduce your problem but you could check a couple of things: 1) Does your buffer use UTF8 encoding? Check the left side of the mode line for a "U" indicator. 2) Is your org-babel-python-command set to python3? I got errors with python2. – NickD May 17 at 16:45
  • @NickD Thanks for your help; the buffer uses UTF8 encoding ( more specifically utf-8-unix) and I have no problem with accented characters outside the results blocks. The problems seems to occur when the result is produced. The variable org-babel-python-command is well set to python3. – Lgen May 17 at 18:37
  • @NickD I finally solved the problem by modifying in emacs: Option > Multilingual Environment > Set Language Environnement > UTF-8 and it work (I do not understand exactly why) – Lgen May 19 at 13:53
  • OK - glad you worked it out. It may be that one of the buffers that org-babel uses ended up with the wrong encoding. – NickD May 19 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.