From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter Dyballa Newsgroups: gmane.emacs.help Subject: Re: Encoding error when calling a ruby script from Emacs using shell-command Date: Sat, 1 Sep 2012 00:40:21 +0200 Message-ID: References: <15C37C1E-38F8-4430-A7D1-24DAEE219161@Web.DE> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1346452839 20492 80.91.229.3 (31 Aug 2012 22:40:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Aug 2012 22:40:39 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Marcelo de Moraes Serpa Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 01 00:40:40 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T7ZtA-00070Y-QS for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Sep 2012 00:40:32 +0200 Original-Received: from localhost ([::1]:36525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7Zt8-0002h0-FD for geh-help-gnu-emacs@m.gmane.org; Fri, 31 Aug 2012 18:40:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7Zt3-0002gv-Rl for help-gnu-emacs@gnu.org; Fri, 31 Aug 2012 18:40:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7Zt2-0001hj-Oj for help-gnu-emacs@gnu.org; Fri, 31 Aug 2012 18:40:25 -0400 Original-Received: from mout.web.de ([212.227.17.12]:60090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7Zt2-0001dZ-EE for help-gnu-emacs@gnu.org; Fri, 31 Aug 2012 18:40:24 -0400 Original-Received: from [192.168.178.8] ([95.222.201.211]) by smtp.web.de (mrweb001) with ESMTPA (Nemesis) id 0LkPW7-1TjNgE49hT-00bXiv; Sat, 01 Sep 2012 00:40:22 +0200 In-Reply-To: X-Mailer: Apple Mail (2.1084) X-Provags-ID: V02:K0:zVEJ+5A9pXFd1oIakMsshqa1tdaKnH+TvHhxbkxxtfQ S0YE6xcqXrYbTwLlHMPGpQ9QmyCAsmqrnj8h3Op1/fFNmCpnjZ JVXKxZ6QxWao5Ik3emLS/ySYns3Vpmf6dq6MKlKEZ9GDCn3Hdh N64PPn9lhd8SFkyP8Q3pEOOSThVpBgPOIC7rl2nsZ/twScMVZ+ efI3Wbl/oEys0MsWx9aZQ== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.17.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86615 Archived-At: 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: >=20 > =E2=9C=97 export | grep UTF > LANG=3Den_US.UTF-8 > LC_ALL=3Den_US.UTF-8 > LC_CTYPE=3Den_US.UTF-8 >=20 > So, I did this: >=20 > (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=E2=80=A6 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=3Den_US.UTF-8 LC_ALL=3Den_US.UTF-8 LC_CTYPE=3Den_US.UTF-8= emacs =E2=80=A6 & 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=3Den_US.UTF-8 LC_ALL=3Den_US.UTF-8 = LC_CTYPE=3Den_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. =E2=80=93 Amiri Baraka, 1999