[XML-SIG] [OT] locale.py doesn't work? (fwd)

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Tue, 6 Feb 2001 09:53:47 +0100


> I am sorry for offtopic, but I can't contact Martin at
> martin@mira.cs.tu-berlin.de for a week already.
> (connection refused)

Sorry for any confusion this has caused; please use
martin@loewis.home.cs.tu-berlin.de (which *should* be the From:
address in this message).

BTW, i18n-sig@python.org would have been the right for this kind of
issue.

> print locale.string.uppercase
> print locale.string.lowercase
> 
> # End of try_locale.py
> 
> > ./try_locale.py
> ['ru_RU', 'ISO8859-5']
> ABCDEFGHIJKLMNOPQRSTUVWXYZ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸ º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
> abcdefghijklmnopqrstuvwxyzÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïñòóôõö÷øùúûüþÿ
> 
> - which is wrong, because koi8-r uppercase letters are different.

Interesting. Please run the C program

#include <locale.h>
#include <ctype.h>

int main()
{
	int i;
	printf("%s\n",setlocale(LC_ALL,"ru_RU"));
	for(i=1;i<256;i++){
		if(islower(i))
			printf("%d, ",i);
	}
	printf("\n");
}

on your system. It is supposed to print the decimal values of all
lowercase letters. As you'll find, it prints the numeric values of all
letters in string.letters (try map(ord, string.letters) to obtain such
a list in Python).

I get the same results on my Linux installation, which uses glibc
2.1.3. So I'd say it is a bug in the C library; please submit a bug
using the glibcbug script if you agree, or complain to your Linux
distributor. If you find out a solution, please let us know.

Regards,
Martin