From ripley at stats.ox.ac.uk  Fri Aug 21 11:10:11 2009
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri, 21 Aug 2009 10:10:11 +0100 (BST)
Subject: [Rd] sessionInfo() fails to correctly detect locale settings
In-Reply-To: <4A8E588B.5090803@biostat.ku.dk>
References: <68b1e2610908210050j70846657k9c900348240800d0@mail.gmail.com>
	<4A8E588B.5090803@biostat.ku.dk>
Message-ID: <alpine.LFD.2.00.0908211005530.30839@gannet.stats.ox.ac.uk>

On Fri, 21 Aug 2009, Peter Dalgaard wrote:

> Liviu Andronic wrote:
>> Dear R devels
>> Yesterday I was slightly surprised to notice that R incorrectly
>> detected some of the locale settings. I am not sure whether this is
>> important, but I preferred to drop a message. In the R output below,
>> some entries that should have been "en_GB.UTF-8" are presented as "C".
>> Regards
>> Liviu
>
> R only sets the entries it needs. In particular, you most definitely do
> not want LC_NUMERIC automatically set to your current locale, as this
> may cause system I/O to use "," instead of "." in numbers.

It might be worth pointing out that C programs start in the 'C" 
locale, not the locale of the OS session.  So only when a program 
deliberately set a locale category is the value not 'C".

(That's what the standards say: implementations may differ, of course, 
but apart from some minor difference with MinGW on Windows, I am not 
aware of any.)

>
>
>>> sessionInfo()
>> R version 2.9.1 (2009-06-26)
>> x86_64-pc-linux-gnu
>>
>> locale:
>>
>
> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] fortunes_1.3-6 relimp_1.0-1
>>
>> loaded via a namespace (and not attached):
>> [1] tcltk_2.9.1
>>
>>
>> liviu at debian-liv:~$ locale
>> LANG=en_GB.UTF-8
>> LC_CTYPE="en_GB.UTF-8"
>> LC_NUMERIC="en_GB.UTF-8"
>> LC_TIME="en_GB.UTF-8"
>> LC_COLLATE="en_GB.UTF-8"
>> LC_MONETARY="en_GB.UTF-8"
>> LC_MESSAGES="en_GB.UTF-8"
>> LC_PAPER="en_GB.UTF-8"
>> LC_NAME="en_GB.UTF-8"
>> LC_ADDRESS="en_GB.UTF-8"
>> LC_TELEPHONE="en_GB.UTF-8"
>> LC_MEASUREMENT="en_GB.UTF-8"
>> LC_IDENTIFICATION="en_GB.UTF-8"
>> LC_ALL=
>>
>>
>>
>>
>
>
> --
>   O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
>  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
> (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] sessionInfo() fails to correctly detect locale settings
Prof Brian Ripley