When I evaluate ruby code blocks inside org-mode I encounter utf-8 errors.
and indeed If i do
#+BEGIN_SRC ruby :exports both :results output
puts RUBY_VERSION
puts __ENCODING__
#+END_SRC
#+RESULTS:
: 2.1.1
: US-ASCII
and when i try to evaluate
#+BEGIN_SRC ruby
'Aurélien'
#+END_SRC
I get this error in Org-Babel Error Output
-:3: invalid multibyte char (US-ASCII)
-:3: invalid multibyte char (US-ASCII)
-:3: syntax error, unexpected end-of-input, expecting keyword_end
'Aurélien'
If I start an inf-ruby buffer I can use utf-8, there is no problem. I think it is a problem with org-babel.
my configuration:
M-x emacs-version
24.4.1M-x org-version
8.2.10M-! ruby --version
2.1.1p76- from package list: inf-ruby 20141005.550 installed
In my init file I have
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq buffer-file-coding-system 'utf-8)
(setq erc-server-coding-system '(utf-8 . utf-8))
(setq locale-coding-system 'utf-8)
;; Treat clipboard input as UTF-8 string first; compound text next, etc.
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
Is there a setting to change to have utf-8 by default for ruby code blocks and org-babel?
I found the problem.
On my mac, Emacs with a GUI default environment encoding is
C
.In my init file, I specified an environment encoding with
and org-babel picks it up correctly