[ESS] Different results for Sys.getlocale()

Marc Schwartz marc_schwartz at me.com
Wed Mar 17 13:36:04 CET 2010


On Mar 17, 2010, at 4:03 AM, Martin Maechler wrote:

>>>>>> "CZ" == Christian Zang <christian.zang at fh-weihenstephan.de>
>>>>>>    on Wed, 17 Mar 2010 08:00:39 +0100 writes:
> 
>    CZ> Dear list, I am using ESS 5.8 with Emacs 23.1 and R
>    CZ> 2.10.1 on Mac OSX 10.6 and have a problem with the
>    CZ> locale. In terminal R and GUI R everything is fine, but
>    CZ> in ESS, umlauts (like \"{u}) are not displayed properly
>    CZ> (but with a leading quotation mark like "u, which makes
>    CZ> ESS display the following text like a
>    CZ> string). Sys.locale in Terminal or GUI gets me
>    CZ> "en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8"
>    CZ> (GUI) or
>    CZ> "de_DE.UTF-8/en_US.UTF-8/C/C/de_DE.UTF-8/de_DE.UTF-8"
>    CZ> (terminal), but with ESS, I only get "C".
> 
> ouch..
> 
> Is this also true, when you start Emacs
> 
>     M-x shell
> and type
>    locale 
> in that shell ?
> 
> I expect your answer to be "yes".

Yes...  :-)

> In that case, you need help about "Emacs on Mac OSX" (and use
> M-x shell as example to demonstrate the problem)
> rather than help on ESS.
> 
> Regards,
> Martin
> 
>    CZ> Has anyone come across that problem and could point me
>    CZ> to some solution? Thanks!
> 
>    CZ> Best, Christian


Try putting the following in your ~/.emacs file:

  (setenv "LANG" "en_US.UTF-8")

This will set the locale within emacs when run on OSX. Adjust as you may require for your specific locale.

The problem is that vanilla GUI based emacs 23 running on OSX does not, by default, pick up the shell environment. I have to do this with my $PATH setting in order to be able to run certain shell scripts from within ESS. My recollection is that some of the other pre-packaged versions of emacs for OSX (eg. Aquamacs, Carbon Emacs) have locally added init code that does this invisibly.

BTW, if you were to Google for this issue, you may see references to the use of ~/.MacOSX/environment.plist. Do not use this approach to setting environment variables, as it introduces other complications.

HTH,

Marc Schwartz



More information about the ESS-help mailing list