Hi,
I've got several complaints about case-nonsensitive search doesn't
working with 6.5.1 and locale enabled (koi8-r) under FreeBSD 3.1 release
Everything works fine if locale was hardcoded in main.c !
They checked that environment is set before running postmaster
and locale works fine on their machines.
It seems environment doens't pass to program (main.c)
I have no right now access to FreeBSD machine but I did test locale setup
with 6.5 under FreeBSD 3.1 and had no problem. But because I've got
several complaints probably there is some real problem.
When I implement several years ago locale support I was sure, that
setlocale(LC_CTYPE,"") should get value of LC_CTYPE from an environment
This is ok for Linux, Solaris and DUX I just checked setlocale man pages.
But something is unclear in FreeBSD 3.1 man page. As far as I remember
something were written about NULL (not "") value. i.e.
setlocale(LC_CTYPE,NULL) returns current locale setting. What does 'current'
means ,
Could somebody check how locale environment passed to program
under FreeBSD 3.1 ?
Something like this simple program should be fine:
-----------------------------------------------
#include<locale.h>
#include<stdlib.h>
#include<stdio.h>
void main(){ if (setlocale(LC_CTYPE, "")){ printf("locale: ok.\n\n"); } else { printf("Failed to set locale.\n\n");
return;}}
----------------------------------------------
Under Linux I got:
1. Non-existent locale
4:47[mira]:~/app/pgsql/locale>setenv LC_CTYPE tt
14:47[mira]:~/app/pgsql/locale>./locale_test
Failed to set locale.
2. Locale exists
14:47[mira]:~/app/pgsql/locale>setenv LC_CTYPE koi8-r
14:48[mira]:~/app/pgsql/locale>./locale_test
locale: ok.
3. LC_CTYPE is getting from LANG - bad locale
14:48[mira]:~/app/pgsql/locale>unsetenv LC_CTYPE
14:49[mira]:~/app/pgsql/locale>setenv LANG tt
14:49[mira]:~/app/pgsql/locale>./locale_test
Failed to set locale.
4. LC_CTYPE is getting from LANG - good locale
14:49[mira]:~/app/pgsql/locale>setenv LANG koi8-r
14:50[mira]:~/app/pgsql/locale>./locale_test
locale: ok.
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83