lib/icu/Canonicalize: use unorm2_normalize() instead of u_strFoldCase()
unorm2_normalize() can case-fold as well, plus it applies Unicode normalization which MPD should do for proper string comparisons.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include "util/AllocatedString.hxx"
|
||||
|
||||
#ifdef HAVE_ICU
|
||||
#include "FoldCase.hxx"
|
||||
#include "Normalize.hxx"
|
||||
#include "Util.hxx"
|
||||
#include "util/AllocatedArray.hxx"
|
||||
#include "util/SpanCast.hxx"
|
||||
@@ -39,10 +39,11 @@ try {
|
||||
if (u.data() == nullptr)
|
||||
return {src};
|
||||
|
||||
if (fold_case)
|
||||
if (auto folded = IcuFoldCase(ToStringView(std::span{u}));
|
||||
folded != nullptr)
|
||||
u = std::move(folded);
|
||||
if (auto n = fold_case
|
||||
? IcuNormalizeCaseFold(ToStringView(std::span{u}))
|
||||
: IcuNormalize(ToStringView(std::span{u}));
|
||||
n != nullptr)
|
||||
u = std::move(n);
|
||||
|
||||
return UCharToUTF8(ToStringView(std::span{u}));
|
||||
#else
|
||||
|
Reference in New Issue
Block a user