|XP is just a number|
Sorting according to locale collationby amir_e_a (Hermit)
|on Apr 22, 2007 at 10:52 UTC||Need Help??|
amir_e_a has asked for the
wisdom of the Perl Monks concerning the following question:
(This message uses special characters, which may be displayed incorrectly on your system:
Thanks for understanding.)
I'm writing a Perl program that processes a text in the Lithuanian language.
Lithuanian uses the Latin alphabet with some modifications. One of the curious properties of this language is the alphabetic order. There are three variations of the letter I: I, Y and Į (the last one is supposed to look like an I with a tail). They are considered as one and the same letter when words are sorted alphabetically, so the Y doesn't come between X and Z and not even between I and J, but is mixed with I. For example, the following list is taken straight from a dictionary. :
As you see, these words are sorted as if they were all written with an I.
As far as i understand, Perl's sort function uses the locale to determine the collation order. I'm trying to set a Lithuanian locale by saying
... And then i run:
According to Lithuanian rules this should have printed:
... but instead it prints:
Am i doing something wrong? Or maybe Perl just doesn't know about the different locales? Or maybe Perl is supposed to know, but it is a bug?
I tried the above code with ActivePerl 5.8.8 build 820 on Windows XP SP2 and with Perl 5.8.0 on Red Hat Enterprise Linux kernel 2.4.21 (i'm not sure which version of RHEL exactly it is). The results were the same.
Thanks in advance for any help.