in reply to
RFC: Is this the correct use of Unicode::Collate?
It’s quite unclear what it is that you really want here. It doesn’t make much sense to run a text sort on nontextual data, which is what control characters are. Why should invisible characters make any difference to how text sorts? They shouldn’t. The whole point of the UCA is that it does not behave like a text-ignorant code-point sort; it’s a text sort, which is a completely different beastie. What you’ve showed seems completely correct to me, so I don’t understand what you want.
I suppose that it is perhaps possible that you may wish to change the weighting of the variably-weighted elements such that they are not ignored the first time around. The constructor’s variable named-argument accepts four possible values to alter how otherwise-ignored code points are to be treated. Per the manpage:
- Variable elements are made ignorable at levels 1 through 3;
considered at the 4ᵗʰ level.
- Variable elements are not reset to ignorable.
- Variable elements are made ignorable at levels 1 through 3
their level 4 weight is replaced by the old level 1 weight.
Level 4 weight for Non-Variable elements is 0xFFFF.
- Same as shifted, but all FFFF’s at the 4ᵗʰ level
So perhaps variable => "non-ignorable"
might be more to your liking, or one of the other three possible settings.
You may also want to set upper_before_lower => 1.