From: Peter Dyballa <Peter_Dyballa@web.de>
To: Marcelo de Moraes Serpa <celoserpa@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Encoding error when calling a ruby script from Emacs using shell-command
Date: Sat, 1 Sep 2012 00:40:21 +0200 [thread overview]
Message-ID: <C1B2EDFD-D70E-4E6C-8995-28E5516553E9@web.de> (raw)
In-Reply-To: <CACHMzOGaX=h_HhQiETNuvZ56ctsJd3JRKHocEs+WU+2mCP3Vwg@mail.gmail.com>
Am 01.09.2012 um 00:18 schrieb Marcelo de Moraes Serpa:
> The problem is that emacs' shell-command doesn't use the same environment,
> so it wasn't picking up the value of those three vars:
>
> ✗ export | grep UTF
> LANG=en_US.UTF-8
> LC_ALL=en_US.UTF-8
> LC_CTYPE=en_US.UTF-8
>
> 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")
> )
There are more options…
When you want GNU Emacs to run in an en_US.UTF-8 environment you can either use the three setenv statements in you init file or make the system use this to launch GNU Emacs:
env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 emacs … &
If you want to restrict en_US.UTF-8 for the Ruby sub-shell you could also use without the setenv statements:
(shell-command "env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /Users/myself/.rvm/bin/rvm ruby-1.9.3-p194 do /usr/bin/rubyscript")
The best option, IMO, is though to set in your login script (~/.profile or ~/.bash_profile) the en_US.UTF-8 environment. Then you'd have this available everywhere: in shells inside terminal emulations, the X Windows system, and its clients.
--
Greetings
Pete
One cannot live by television, video games, top ten CDs, and dumb movies alone.
– Amiri Baraka, 1999
prev parent reply other threads:[~2012-08-31 22:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-30 17:40 Encoding error when calling a ruby script from Emacs using shell-command Marcelo de Moraes Serpa
2012-08-30 17:41 ` Marcelo de Moraes Serpa
2012-08-30 21:16 ` Peter Dyballa
2012-08-30 23:01 ` Marcelo de Moraes Serpa
2012-08-31 22:18 ` Marcelo de Moraes Serpa
2012-08-31 22:40 ` Peter Dyballa [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C1B2EDFD-D70E-4E6C-8995-28E5516553E9@web.de \
--to=peter_dyballa@web.de \
--cc=celoserpa@gmail.com \
--cc=help-gnu-emacs@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.