On Mon, Sep 08, 2025 at 07:22:37AM -0400, Greg Wooledge wrote:
> On Mon, Sep 08, 2025 at 04:59:48 -0400, Grisha Levit wrote:
> > Alternatively, we could check that the _range_ ends are ASCII characters
> > (and, depending on the desired behavior, check the character being tested
> > as well) before disabling locale-aware collation.
>
> This one makes the most sense to me -- the first half, I mean.
>
> With globasciiranges on, we want [0-5] to match *only* the characters
> 0, 1, 2, 3, 4 and 5.  We want to disable locale-aware collation for all
> characters when matching against this range, so that characters like ⁴
> (superscript 4) are not matched.  If locale-aware collation is allowed
> between 0 and ⁴, and between ⁴ and 5, then we get a false match.
> I think that's what's happening currently.
>
> hobbit:/tmp/x$ ls
> 1  2  ²  3  ⁴  ⁵
> hobbit:/tmp/x$ shopt -u globasciiranges
> hobbit:/tmp/x$ echo [0-5]
> 1 2 ² 3 ⁴
> hobbit:/tmp/x$ shopt -s globasciiranges
> hobbit:/tmp/x$ echo [0-5]
> 1 2 3 ⁴
>
> Superscript 2 is correctly excluded, but superscript 4 is incorrectly
> included.
>
And superscript 5 is not shown because it sorts after '5' which is end of range.
If you try [0-6], I think you might see it.

Cheers ... Duncan.

Reply via email to