From Martin Maechler <maechler@stat.math.ethz.ch>  Fri Nov 28 07:45:39 1997
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Fri, 28 Nov 1997 08:45:39 +0100
Subject: R-alpha:  Latin-1 characters / Locale etc.
In-Reply-To: <x2zpmquyvg.fsf@blueberry.kubism.ku.dk> (message from Peter
 Dalgaard BSA on 27 Nov 1997 16:42:43 +0100)
Message-ID: <199711280745.IAA04422@sophie.ethz.ch>

[to R-devel,  for everyone's information;
 thanks a lot, Peter!]

>>>>> "PD" =3D=3D Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> writes:

    PD> Hmmm. You may need a call to 
       
    PD> #include <locale.h>
    PD> setlocale(LC_ALL,"")

    PD> (or LC_CTYPE?) before your environment variables take effect.

Yes, this was `it'.  
Maybe  R  needs such a call also? (I did not yet look in the src)


sophie{maechler}328> cat isalpha-tst.c
=09=09=09 -------------
/*--- Testing  'locale' [env.variable  LC_CTYPE ] --------------- */

#include <ctype.h> /*- isalpha(.) -*/
#include <stdio.h> /*- putchar(.) -*/
#include <locale.h>

unsigned char c =3D 0;
char *p;
void main()
{
  setlocale(LC_ALL,"");

  while(++c)
    if ( isalpha(c) ) putchar(c);
  putchar('\n');
}
sophie{maechler}329> cc isalpha-tst.c
sophie{maechler}330> cc -V
cc: SC3.0.1 13 Jul 1994
usage: cc [ options] files.  Use 'cc -flags' for details

sophie{maechler}314> printenv LC_CTYPE
iso_8859_1

sophie{maechler}331> isalpha-tst 
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=C0=C1=C2=C3=C4=C5=C6=
=C7=C8=C9=CA=CB=CC=CD=CE=CF=D0=D1=D2=D3=D4=D5=D6=D8=D9=DA=DB=DC=DD=DE=DF=E0=
=E1=E2=E3=E4=E5=E6=E7=E8=E9=EA=EB=EC=ED=EE=EF=F0=F1=F2=F3=F4=F5=F6=F8=F9=FA=
=FB=FC=FD=FE=FF

sophie{maechler}332> gcc -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/spec=
s
gcc version 2.7.2.1
sophie{maechler}333> gcc isalpha-tst.c
sophie{maechler}334> isalpha-tst
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=C0=C1=C2=C3=C4=C5=C6=
=C7=C8=C9=CA=CB=CC=CD=CE=CF=D0=D1=D2=D3=D4=D5=D6=D8=D9=DA=DB=DC=DD=DE=DF=E0=
=E1=E2=E3=E4=E5=E6=E7=E8=E9=EA=EB=EC=ED=EE=EF=F0=F1=F2=F3=F4=F5=F6=F8=F9=FA=
=FB=FC=FD=FE=FF



sophie{maechler}335> unsetenv LC_CTYPE
sophie{maechler}336> isalpha-tst
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

sophie{maechler}337> setenv LC_CTYPE C
sophie{maechler}338> isalpha-tst
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

sophie{maechler}339> setenv LC_CTYPE es=09#-- espa=F1ol
sophie{maechler}340> isalpha-tst
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=C0=C1=C2=C3=C4=C5=C6=
=C7=C8=C9=CA=CB=CC=CD=CE=CF=D0=D1=D2=D3=D4=D5=D6=D8=D9=DA=DB=DC=DD=DE=DF=E0=
=E1=E2=E3=E4=E5=E6=E7=E8=E9=EA=EB=EC=ED=EE=EF=F0=F1=F2=F3=F4=F5=F6=F8=F9=FA=
=FB=FC=FD=FE=FF
sophie{maechler}341> setenv LC_CTYPE de #-- deutsch
sophie{maechler}342> isalpha-tst
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=C0=C1=C2=C3=C4=C5=C6=
=C7=C8=C9=CA=CB=CC=CD=CE=CF=D0=D1=D2=D3=D4=D5=D6=D8=D9=DA=DB=DC=DD=DE=DF=E0=
=E1=E2=E3=E4=E5=E6=E7=E8=E9=EA=EB=EC=ED=EE=EF=F0=F1=F2=F3=F4=F5=F6=F8=F9=FA=
=FB=FC=FD=FE=FF
sophie{maechler}345> setenv LC_CTYPE iso_8859_1
sophie{maechler}346> isalpha-tst
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=C0=C1=C2=C3=C4=C5=C6=
=C7=C8=C9=CA=CB=CC=CD=CE=CF=D0=D1=D2=D3=D4=D5=D6=D8=D9=DA=DB=DC=DD=DE=DF=E0=
=E1=E2=E3=E4=E5=E6=E7=E8=E9=EA=EB=EC=ED=EE=EF=F0=F1=F2=F3=F4=F5=F6=F8=F9=FA=
=FB=FC=FD=FE=FF

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


R-alpha: Latin-1 characters / Locale etc.
Martin Maechler