Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Using system sort order

by Arunbear (Prior)
on Aug 11, 2025 at 11:58 UTC ( [id://11166008]=note: print w/replies, xml ) Need Help??


in reply to Using system sort order

On Linux, without the -Mlocale switch, I get the same behaviour that you get on Windows. To get the result you wish, I used Unicode::Collate e.g.
#! perl use strict; use warnings; use utf8; use Unicode::Collate; binmode STDOUT => ':utf8'; my @words = ( "Maria Lenore", "Mária Helena", "María Dolores" ); my $col = Unicode::Collate->new(level => 1); my @sorted = $col->sort(@words); if ( "@sorted" eq "María Dolores Mária Helena Maria Lenore" ) { print("Sorted OK\n"); } elsif ( "@sorted" eq "Maria Lenore María Dolores Mária Helena" ) { print("Sorted C (ASCII)\n"); } else { print("Sort failed: @sorted\n"); }
I had these bookmarked ages ago, but didn't look at them until today:

Replies are listed 'Best First'.
Re^2: Using system sort order
by sciurius (Beadle) on Aug 11, 2025 at 14:31 UTC
    Thanks for the suggestion! This does, indeed, give the desired results on both Windows and macOS.

    But it does not use the system settings...
    See e.g. https://youtu.be/j64acCeati4?t=548 .

    For the time being it is already a substantial improvement.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11166008]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2026-04-21 02:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.