From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [OT] Encoding error when calling a ruby script from Emacs using shell-command Date: Sat, 01 Sep 2012 09:53:12 -0400 Message-ID: <9439.1346507592@alphaville> References: <7522.1346442688@alphaville> <87d326rylb.fsf@Rainer.invalid> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:49684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7o8V-0000hE-Se for emacs-orgmode@gnu.org; Sat, 01 Sep 2012 09:53:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7o8U-0002GA-Mj for emacs-orgmode@gnu.org; Sat, 01 Sep 2012 09:53:19 -0400 Received: from g4t0016.houston.hp.com ([15.201.24.19]:31613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7o8U-0002G4-GT for emacs-orgmode@gnu.org; Sat, 01 Sep 2012 09:53:18 -0400 In-Reply-To: Message from Achim Gratz of "Sat\, 01 Sep 2012 09\:28\:32 +0200." <87d326rylb.fsf@Rainer.invalid> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Achim Gratz Cc: emacs-orgmode@gnu.org Achim Gratz 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.