Re: Is Sort:Naturally a Little Off?

[email protected] (Shawn H Corey) Sat, 25 Sep 2021 03:26:07 -0400
Newsgroups perl.module-authors
Message-ID <[email protected]>
--------------ABF7336CA2682F74A731F022
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

On 2021-09-25 3:01 a.m., Smylers wrote:
> That does look odd. Which locale are you running this under, which
> version of Perl, and which version of Sort::Naturally?
>
> Also, when I first ran your script I initially got lots of:
>
>    Wide character in say at ./naturally line 23.
>
> Adding this made Perl encode the output properly and the warning go
> away:
>
>    use open ':locale';
>
> But that you didn't need to do that makes me think there's something
> different about your set-up.
>
> Also, even your ‘no locale, naturally’ line apparently*is*  affected by
> the locale! With LC_COLLATE=C, I get:
>
>    no locale,  naturally : 1 4 10 A a And and ant Any B b C c i X x Y y Z z Ä ä Äm än ÄND Äs Į į

"Curiouser and curiouser," said Alice. Yes, the last one is sorted by 
Unicode character codes.

My perl is v5.30.0. My Sort::Naturally is 1.03. And my environment is:

$ env|grep LC_|sort
LC_ADDRESS=en_CA.UTF-8
LC_IDENTIFICATION=en_CA.UTF-8
LC_MEASUREMENT=en_CA.UTF-8
LC_MONETARY=en_CA.UTF-8
LC_NAME=en_CA.UTF-8
LC_NUMERIC=en_CA.UTF-8
LC_PAPER=en_CA.UTF-8
LC_TELEPHONE=en_CA.UTF-8
LC_TIME=en_CA.UTF-8


--------------ABF7336CA2682F74A731F022
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 2021-09-25 3:01 a.m., Smylers wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:[email protected]">
      <pre class="moz-quote-pre" wrap="">That does look odd. Which locale are you running this under, which
version of Perl, and which version of Sort::Naturally?

Also, when I first ran your script I initially got lots of:

  Wide character in say at ./naturally line 23.

Adding this made Perl encode the output properly and the warning go
away:

  use open ':locale';

But that you didn't need to do that makes me think there's something
different about your set-up.

Also, even your ‘no locale, naturally’ line apparently <b class="moz-txt-star"><span class="moz-txt-tag">*</span>is<span class="moz-txt-tag">*</span></b> affected by
the locale! With LC_COLLATE=C, I get:

  no locale,  naturally : 1 4 10 A a And and ant Any B b C c i X x Y y Z z Ä ä Äm än ÄND Äs Į į</pre>
    </blockquote>
    <p>"Curiouser and curiouser," said Alice. Yes, the last one is
      sorted by Unicode character codes.</p>
    <p>My perl is v5.30.0. My Sort::Naturally is 1.03. And my
      environment is:</p>
    <p><font face="monospace">$ env|grep LC_|sort<br>
        LC_ADDRESS=en_CA.UTF-8<br>
        LC_IDENTIFICATION=en_CA.UTF-8<br>
        LC_MEASUREMENT=en_CA.UTF-8<br>
        LC_MONETARY=en_CA.UTF-8<br>
        LC_NAME=en_CA.UTF-8<br>
        LC_NUMERIC=en_CA.UTF-8<br>
        LC_PAPER=en_CA.UTF-8<br>
        LC_TELEPHONE=en_CA.UTF-8<br>
        LC_TIME=en_CA.UTF-8</font><br>
      <br>
    </p>
  </body>
</html>

--------------ABF7336CA2682F74A731F022--