[GRASS5] [bug #3591] (grass) d.vect.thematic (and other scripts): LC_NUMERIC setting not used in my Debian

Michael Barton michael.barton at asu.edu
Thu Sep 1 11:29:41 EDT 2005


My understanding of the main reason for using LC_NUMERIC in d.vect.thematic
and other scripts is that without it, the math chokes on European notation
(i.e., using a comma rather than a period/fullstop to signal decimal
places).

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton



> From: Markus Neteler <neteler at itc.it>
> Date: Wed, 31 Aug 2005 22:22:40 +0200
> To: Glynn Clements <glynn at gclements.plus.com>
> Cc: Moritz Lennert <mlennert at club.worldonline.be>, Request Tracker
> <grass-bugs at intevation.de>, <grass5 at grass.itc.it>
> Subject: Re: [GRASS5] [bug #3591] (grass) d.vect.thematic (and other scripts):
> LC_NUMERIC setting not used in my Debian
> 
> On Wed, Aug 31, 2005 at 09:00:17PM +0100, Glynn Clements wrote:
>> 
>> Moritz Lennert wrote:
>> 
>>>>> this bug's URL: http://intevation.de/rt/webrt?serial_num=3591
>>>>> -------------------------------------------------------------------------
>>>>> 
>>>>> Subject: d.vect.thematic (and other scripts): LC_NUMERIC setting not
>>>>> used in my Debian
>>>> 
>>>> 
>>>> GRASS doesn't use any of the locale categories except for LC_MESSAGES
>>>> (if it was built using --with-nls).
>> 
>> Actually, I've just noticed that it also uses LC_CTYPE (again, only if
>> built using --with-nls):
>> 
>> revision 1.8
>> date: 2004/08/27 11:16:51;  author: markus;  state: Exp;  lines: +1 -0
>> added LC_TYPE for japanese
> 
> To what file do you refer?
> 
> Aha:
> 2004-08-27 13:16  markus
> * lib/gis/locale.c: added LC_TYPE for japanese
> 
> The change was actually
> 
> ~/grass61/lib/gis > cvs diff -r 1.7 -r 1.8 locale.c
> Index: locale.c
> ===================================================================
> RCS  /home/grass/grassrepository/grass6/lib/gis/locale.c,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -u -r1.7 -r1.8
> --- locale.c    13 May 2002 07:02:19 -0000      1.7
> +++ locale.c    27 Aug 2004 11:16:51 -0000      1.8
> @@ -35,6 +35,7 @@
> 
>         if (!initialized)
>         {
> +               setlocale(LC_CTYPE, "");
>                 setlocale(LC_MESSAGES, "");
>                 initialized = 1;
>         }
> 
> 
>> This looks pretty dubious, as it changes the behaviour of many of the
>> <ctype.h> functions (isalpha(), tolower() etc) as well as
>> strcasecmp(), but GRASS' built-in string handling always assumes ASCII
>> (e.g. G_strcasecmp() only considers A-Z/a-z regardless of the locale).
> 
> So, should we remove LC_CTYPE?
> 
> 
>>> mlennert at moritz:~/CVS/GRASS/grass6/scripts$ grep -R LC_NUMERIC *
>>> d.correlate/d.correlate:export LC_NUMERIC=C
>>> d.out.png/d.out.png:export LC_NUMERIC=C
>>> d.resize/d.resize:export LC_NUMERIC=C
>>> d.vect.thematic/d.vect.thematic:export LC_NUMERIC=C
>>> i.fusion.brovey/i.fusion.brovey:export LC_NUMERIC=C
>> 
>> [snip]
>> 
>>> So it is used quite a lot in scripts.
>> 
>> In all cases, it's forced to "C", which is the same as it not being
>> used. Scripts do this to prevent other programs (e.g. awk) from using
>> the user's LC_NUMERIC settings, so that they don't end up passing
>> floating-point values which use a comma to programs which expect a
>> dot.
>> 
> 
> I have added it everywhere upon your suggestion:
>  http://grass.itc.it/pipermail/grass5/2005-March/017637.html
> 
> Maybe a misunderstanding. What do do now?
> 
> Markus
> 




More information about the grass-dev mailing list