Closed Hywan closed 11 years ago
Collation support is out of scope for Patchwork UTF-8, you have to use Collator as you figured out instead.
u::strcmp() is suitable for equality comparisons of NFC, NFD and non-normalized strings, but falls short in term of inequalities. I can't figure out any generic enough sorting method, so currently, that's how it works. So, not a bug...
But if you have any better idea, please tell me!
Thanks for reporting
You could also use u::strnatcmp(), u::strcasecmp() or even u::strnatcasecmp() if you do not bother for diacritics and/or case
There is no better solution than Collator
+ locale
:-). So it's not an issue, thanks!
Hello,
In
strcmp
, you normalize strings but it does not solve the problem of collation. For example,côte < coté
(in french), andstrcmp
returns88
. The result is not the same when usingCollator
:But, I can't figure out if it is an issue or not, since
strcmp
should normally perform a binary-safe comparison, but you normalize strings in order to compare them. So it's like an attempt to solve this problem.Thoughts?