[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [OT] Encoding error when calling a ruby script from Emacs using
From: |
Nick Dokos |
Subject: |
Re: [O] [OT] Encoding error when calling a ruby script from Emacs using shell-command |
Date: |
Sat, 01 Sep 2012 09:53:12 -0400 |
Achim Gratz <address@hidden> wrote:
> Marcelo de Moraes Serpa writes:
> > So, I did this:
> >
> > (defun test ()
> > (setenv "LANG" "en_US.UTF-8")
> > (setenv "LC_ALL" "en_US.UTF-8")
> > (setenv "LC_CTYPE" "en_US.UTF-8")
> > (shell-command "/Users/myself/.rvm/bin/rvm ruby-1.9.3-p194 do
> > /usr/bin/rubyscript"))
>
> This is nonsense, may I suggest you read locale (1p)? If you set
> LC_ALL, this overrides the other two settings no matter what they are
> set to (and you may prevent some scripts trying to set LC_COLLATE or
> something like that from functioning correctly). Unless you really need
> such a big hammer, set LANG (this provides the default) and leave it at
> that.
>
I don't understand why such a hammer is needed at all: if LANG (or
LC_ALL) is set in a login shell[fn:1] and exported, then all child
processes (including emacs and including any shells that emacs spawns)
will inherit the setting. So if setting it as above with setenv
(i.e. modifying the emacs environment and therefore the processes that
emacs spawns) makes a difference, that suggests that it is not set
globally. I doubt that that is a good idea in general. Even if you want
it just in the case of emacs, it's probably better to do the setenv
first thing in .emacs.
And in that case, how/why does it work from a terminal?
Nick
Footnotes:
[fn:1] Or some equivalent way for a graphical login.