Jorge_de_Burgos has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks. I wonder if any of you has tried to sort a list of names under a Spanish locale system. I find the output puzzling, and you can't blame it on my knowledge of Spanish since that's my native tongue.
I mean, whereas this all-English program:
#!/usr/bin/perl my @list = ('maceira', 'mac alister', 'mac loughlin', 'san esteban', ' +sangregorio', 'san zoilo'); print "$_\n" for sort @list;
outputs this (as expected in the default English perl dialect):
this supposedly Spanified program:mac alister mac loughlin maceira san esteban san zoilo sangregorio
outputs this non-Spanish order:#!/usr/bin/perl use locale; my @list = ('maceira', 'mac alister', 'mac loughlin', 'san esteban', ' +sangregorio', 'san zoilo'); print "$_\n" for sort @list;
mac alister maceira mac loughlin san esteban sangregorio san zoilo
Now please keep in mind that:
- I haven't used any high ASCII character in the list.
- My system locale is "es_AR.UTF-8".
- We Spanish-speaking people would expect the sorted list to come out with all "mac something" and all "san something" before "maceira" and "sangregorio" respectively, making these longer words come out after surnames whose first word is shorter ("mac" and "san").
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Spanish locale and name sorting
by spectre9 (Beadle) on May 01, 2009 at 19:08 UTC | |
by Jorge_de_Burgos (Beadle) on May 01, 2009 at 20:21 UTC | |
Re: Spanish locale and name sorting
by Anonymous Monk on May 02, 2009 at 01:30 UTC | |
by Jorge_de_Burgos (Beadle) on May 02, 2009 at 11:40 UTC | |
by Jorge_de_Burgos (Beadle) on May 02, 2009 at 12:16 UTC | |
by Anonymous Monk on May 02, 2009 at 16:46 UTC | |
by Jorge_de_Burgos (Beadle) on May 02, 2009 at 21:30 UTC |
Back to
Seekers of Perl Wisdom