Open
Description
Description
Calling string.Normalize(form)
or IsNormalized(form)
on an ASCII string when form
is a compatibility form (i.e. FormKD
or FormKC
) does not throw - it only throws if the string is not ASCII. I find this behavior to be a little bit troubling - I think it should always throw for the unsupported form instead of giving false hope that it works. The current behavior can make it look like code paths work and then you get PlatformNotSupportedException
at runtime after deployment when users enter a non-ASCII string.
Reproduction Steps
"asdf".IsNormalized(NormalizationForm.FormKD); // no throw
"😊".IsNormalized(NormalizationForm.FormKD); // throws
Expected behavior
Should always throw when requesting an unsupported form.
Regression?
No
Known Workarounds
No response
Configuration
No response
Other information
No response