Normalizer.GetNormalizer picks the instance name and mode from two ternaries:
return Normalizer2.GetInstance(null,
mode == UNORM_NFC || mode == UNORM_NFD ? "nfc" : "nfkc",
mode == UNORM_NFC || mode == UNORM_NFKC ? COMPOSE : DECOMPOSE);
UNORM_FCD and UNORM_NONE both fall through to "nfkc" + DECOMPOSE, i.e. NFKD. So
Normalizer.Normalize(s, UNORM_FCD) returns NFKD and Normalizer.IsNormalized(s, UNORM_FCD)
answers the NFKD question, with no error.
Normalizer2.Mode already has FCD, so the FCD case can map to "nfc" + Mode.FCD.
UNORM_NONE has no Normalizer2 equivalent and should probably throw rather than quietly
normalize.
Found while measuring whether NFC output is FCD-conformant for
#130 — it isn't always, but the check reported
through UNORM_FCD was answering a different question entirely.
source/icu.net/Normalization/Normalizer.cs:35-43
Normalizer.GetNormalizerpicks the instance name and mode from two ternaries:UNORM_FCDandUNORM_NONEboth fall through to"nfkc"+DECOMPOSE, i.e. NFKD. SoNormalizer.Normalize(s, UNORM_FCD)returns NFKD andNormalizer.IsNormalized(s, UNORM_FCD)answers the NFKD question, with no error.
Normalizer2.Modealready hasFCD, so the FCD case can map to"nfc"+Mode.FCD.UNORM_NONEhas no Normalizer2 equivalent and should probably throw rather than quietlynormalize.
Found while measuring whether NFC output is FCD-conformant for
#130 — it isn't always, but the check reported
through
UNORM_FCDwas answering a different question entirely.source/icu.net/Normalization/Normalizer.cs:35-43