R, LANG, and LC_....

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Thu, 8 Jan 1998 17:45:26 +0100


=09[diverted from R-help  to R-devel]

>>>>> "GB" =3D=3D Goran Brostrom <gb@stat.umu.se> writes:

    GB> On 8 Jan 1998, Peter Dalgaard BSA wrote:

    >> Goran Brostrom <gb@stat.umu.se> writes:
    >> 
    >> > I am running R 0.61.0 on a Sparc 5, Solaris 2.4, in tcsh. Today I
    >> > couldn't, to my big surprise, scan a data file in R. As I finally
    >> > understood it, R wanted a decimal comma instead of a decimal
    >> point, > because LANG was set to 'sv'. See my runs below. I wonder
    >> why this
    >> 
    >> Apparently, the strtod() C library function accepts different
    >> formats depending on locale settings, so probably the
    >> setlocale(LC_ALL,""); in src/main/main.c is doing you in.
    >> 
    >> This is the same thing that allows you to have a variable called
    >> "f=F6r=E4ldre" and see come out right on plots, etc., so you don't w=
ant
    >> to remove that line.
    >> 
    >> I think that either you should setenv LC_NUMERIC to C or POSIX or R
    >> should only set LC_CTYPE (and maybe some of the others?).

    GB> Yes, the combination (LANG =3D sv & LC_NUMERIC =3D C) seems to work
    GB> properly.  Thanks!

    GB> Goran

Peter (and everyone), I still think we should replace

=09setlocale(LC_ALL,"");
by

=09setlocale(LC_CTYPE,"");
=09setlocale(LC_........);
=09setlocale(LC_........);

But probably you know better than me what the  ...... should be.

Note that we still have the problem that R's parser does not properly use
all the isalpha(.) characters when e.g. checking variable names.


- Martin.=
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._