[Gretl-devel] decimal point (2)

Allin Cottrell cottrell at wfu.edu
Fri May 11 10:31:04 EDT 2007


On Fri, 11 May 2007, Ignacio Diaz-Emparanza wrote:

> Well, I see 
> setlocale(LC_NUMERIC, "es_ES.UTF-8") returned es_ES.UTF-8
> but don't get the decimal comma.

Could you try compiling and running this little program?

/* start program */

#include <stdio.h>
#include <stdlib.h>
#include <locale.h>

int main (int argc, char **argv)
{
    char *ret;

    if (argc != 2) {
        fprintf(stderr, "Please give a language specifier\n");
        exit(EXIT_FAILURE);
    }

    ret = setlocale(LC_NUMERIC, NULL);
    printf("Default: LC_NUMERIC=%s\n", ret);
    printf("one-point-five: %g\n", 1.5);

    ret = setlocale(LC_NUMERIC, argv[1]);
    printf("After setlocale: LC_NUMERIC=%s\n", ret);
    printf("one-point-five: %g\n", 1.5);

    return 0;
}

/* end program */

Try saving the above as point.c, and do

  gcc -Wall -o point point.c

Then

  ./point es_ES.UTF-8

Here I get:

waverley:~$ gcc -Wall -o point point.c 
waverley:~$ ./point es_ES.UTF-8
Default: LC_NUMERIC=C
one-point-five: 1.5
After setlocale: LC_NUMERIC=es_ES.UTF-8
one-point-five: 1,5

If you get the same then there is a problem somewhere in gretl.

Allin.


More information about the Gretl-devel mailing list