in reply to Re: Re: Sorting utf-8
in thread Sorting utf-8

Thank you, and also Dakkar, plus all the other kind people who posted,

The solution is indeed to use "Unicode::Collate" together with a file called "allkeys.txt". No locales needed.

Just put "use unicode::collate" and add the lines:
my %tailoring; my $Collator; $Collator = Unicode::Collate->new(%tailoring); @char = $Collator->sort(@char);

and sorting works "automagically"; French is now totally correct; for the other character sets such as Greek it looks logical but I'll get our translators to check the order for me just in case there are still some quirks.

However, Swedish and Finnish no longer sort correctly, because in those languages Ä, Ö etc are considered to come after "Z" so it looks like I'm going to have to do an if/else with "normal" sort and "collate". But who cares, I'm a huge step forward from where I was this morning.

Thanks a lot guys, Anne

Replies are listed 'Best First'.
Re: Re: Re: Re: Sorting utf-8
by Anonymous Monk on Apr 24, 2003 at 15:08 UTC
    Good to hear its kind of working for you!

    But there will be a correct way for handling Swedish and Finnish unicode collation, so I wouldn't start switching between sort and collate in such cases until you've exhausted the "correct" way(s?) of doing this.

    Perhaps you could ask SADAHIRO Tomoyuki, the Unicode::Collate author?

    It would certainly be good if you can post any reply you get here, since this is the kind of stuff perl developers are going to have to know more and more about - I'm of course talking about the folks who don't know it already :)

Re: Re: Re: Re: Sorting utf-8
by richyboy (Acolyte) on Apr 24, 2003 at 21:58 UTC