From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcelo de Moraes Serpa Newsgroups: gmane.emacs.help Subject: Re: Encoding error when calling a ruby script from Emacs using shell-command Date: Fri, 31 Aug 2012 17:18:15 -0500 Message-ID: References: <15C37C1E-38F8-4430-A7D1-24DAEE219161@Web.DE> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=14dae93409831bc4c204c8972b96 X-Trace: ger.gmane.org 1346451506 10724 80.91.229.3 (31 Aug 2012 22:18:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Aug 2012 22:18:26 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Peter Dyballa Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 01 00:18:27 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 1T7ZXm-0006xL-EY for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Sep 2012 00:18:26 +0200 Original-Received: from localhost ([::1]:33442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7ZXk-0008Rk-0n for geh-help-gnu-emacs@m.gmane.org; Fri, 31 Aug 2012 18:18:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7ZXe-0008Mk-1R for help-gnu-emacs@gnu.org; Fri, 31 Aug 2012 18:18:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7ZXc-0002PH-4H for help-gnu-emacs@gnu.org; Fri, 31 Aug 2012 18:18:17 -0400 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:53358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7ZXb-0002M9-Vl for help-gnu-emacs@gnu.org; Fri, 31 Aug 2012 18:18:16 -0400 Original-Received: by mail-iy0-f169.google.com with SMTP id k10so6459789iag.0 for ; Fri, 31 Aug 2012 15:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=gbCMkQL/QqZorVk1Cahv2pzrEsFZObwSX7gipG1NaFg=; b=dCJRECtRftAonb6F5iLJFTlITUsR0ZPo8AlBExoLqdN4Hq382Wt/HUskr+5BbI5VF7 JZGtZz7XNsB0TP2xVTNuEXaN16yPvmI+3vKdGE2AGPG93xSHJhQJl2o/liKwFZMXdS0U SiYQbmEJXI/X9231g4HoX2MmbdHx2Y6/iKvHbW+q8goCA0oA96hgJPC6PTbzz2ozPmPt /OngmqL+fC89iMkeKNGed+rOb7gGAbBfT08lnXc4HmycY/24yJQNJnu1LLlvWx7wm+/C TOoFjRppgzjeLmVqtclIvE93M474SMv/hP5wcRIdK3DpAlBX29IFM2V7VN0YaQ4uIuJi 2W6w== Original-Received: by 10.50.181.200 with SMTP id dy8mr4607297igc.36.1346451495699; Fri, 31 Aug 2012 15:18:15 -0700 (PDT) Original-Received: by 10.64.17.74 with HTTP; Fri, 31 Aug 2012 15:18:15 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.169 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:86614 Archived-At: --14dae93409831bc4c204c8972b96 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Alright, I solved it. 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: =E2=9C=97 export | grep UTF LANG=3Den_US.UTF-8 LC_ALL=3Den_US.UTF-8 LC_CTYPE=3Den_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") ) And now it works fine. Cheers, - Marcelo. On Thu, Aug 30, 2012 at 6:01 PM, Marcelo de Moraes Serpa < celoserpa@gmail.com> wrote: > Hi Peter, > > Thanks for the reply. > > I've changed the func argument to 'utf-8-unix and it did not make a > difference. Same error. > > - Marcelo. > > > On Thu, Aug 30, 2012 at 4:16 PM, Peter Dyballa wrot= e: > >> >> Am 30.08.2012 um 19:41 schrieb Marcelo de Moraes Serpa: >> >> > By the way, I forgot to say that I have added the "(let >> > (universal-coding-system-argument 'us-ascii-mac))" in an attempt to fi= x >> it, >> > but it made no difference whatsoever. >> >> Have you tried an UTF encoding? I think Ruby isn't as primitive as >> US-ASCII=E2=80=A6 >> >> -- >> Greetings >> >> Pete >> >> We are usually convinced more easily by reasons we have found ourselves >> than by those which have occurred to others. >> =E2=80=93 Blaise Pascal >> >> > --14dae93409831bc4c204c8972b96 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Alright, I solved it= .

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:

=E2=9C=97 export | grep UTF
=C2=A0 =C2=A0 LANG=3Den_US.UTF-8= =C2=A0
=C2=A0 =C2=A0 LC_ALL=3Den_US.UTF-8
=C2=A0 =C2=A0= LC_CTYPE=3Den_US.UTF-8

So, I did this:
=
(defun test ()
=C2=A0 (setenv "LANG" "en_US.UTF-8")
=C2=A0 (= setenv "LC_ALL" "en_US.UTF-8")
=C2=A0 (setenv= "LC_CTYPE" "en_US.UTF-8")
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (shell-command =C2=A0"/Users/myself/.rvm/bin/rvm ruby-1.9.3= -p194 do /usr/bin/rubyscript")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 )

And now i= t works fine.

Cheers,

- M= arcelo.


--14dae93409831bc4c204c8972b96--