Perhaps one could write some wrappers of the setlocale() function group that maps the ISO 639 language codes and ISO 3166 country codes into the windows language. Alas, I'm not so familiar with those things. see:
I think the most gnuwin32 tools will ignore LC_... environment variables because they utilise the windows xp native setlocale() function. To substantiate my assumption, I wrote a small program in C:
I'm having problems with sort. I can't manage to sort in ASCII order, even if I set LC_ALL=C. The result I'm getting is:
@@
3@
... and I was expecting:
3@
@@ (I can obtain this when running sort under Cygwin)
Please, can anyone help me?
Thanks a lot Mathias...
I'll try to see if it works...
Alexandre
I've made a little mistake that leads to a crash. I'm sure you'll find and fix it quickly ;-)
Note that on windows you have to set the environment variables LC_* to something line "English" or "English_United States.1252". See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_language_and_country_strings.asp
Perhaps one could write some wrappers of the setlocale() function group that maps the ISO 639 language codes and ISO 3166 country codes into the windows language. Alas, I'm not so familiar with those things. see:
http://www.w3.org/International/resource-index#lang
Kind regards
Mathias
I think the most gnuwin32 tools will ignore LC_... environment variables because they utilise the windows xp native setlocale() function. To substantiate my assumption, I wrote a small program in C:
int main(void) {
printf("%s\n", setlocale( LC_ALL, NULL ));
setlocale( LC_ALL, "");
printf("%s\n", setlocale( LC_ALL, NULL ));
return 0;
}
The output of the program was
C
German_Switzerland.1252
-- independent on LC_ALL! Now, the first thing that happens within sort.c is:
setlocale( LC_ALL, "");
Thus, on my computer sort.exe will work always with the German_Switzerland.1252 locale.
I propose to apply a patch to all gnuwin32 programs that replace the line
setlocale( LC_ALL, "");
by something more meaningful, e.g. by
{
static struct {int id; char const * name;} const locale_list[] = {
{LC_ALL, "LC_ALL"},
{LC_COLLATE, "LC_COLLATE"},
{LC_CTYPE, "LC_CTYPE"},
{LC_MONETARY, "LC_MONETARY"},
{LC_NUMERIC, "LC_NUMERIC"},
{LC_TIME, "LC_TIME"}
};
int index;
}
I guess that is what happens with the posix setlocale that the gnuwin32 utilities are expecting to handle with.
With kind regards
Mathias