3 ms·
Not really. Case (in) sensitivity and accent (in)sensitivity are two orthogonal things. If you want to compare two strings, ignoring case differences, convertin
by mormegil 6y ago
Not really. Case (in) sensitivity and accent (in)sensitivity are two orthogonal things. If you want to compare two strings, ignoring case differences, converting both to lowercase (or uppercase) is completely fine in Javascript (it might be problematic in other languages because of Turkish dotted and dotless i, but in JS, the obvious first-choice toLowerCase() is locale-ignorant, you would need to use toLocaleLowerCase() to be bitten by the problem and why would do that?). Obviously, the method considers "Á" and "a" to be different, but why wouldn't it? Those characters differ in accents, not only in case.
- davethedevguy 6y ago> Case (in) sensitivity and accent (in)sensitivity are two orthogonal things Is that definitely true? As I understand it (and I admit I'm no expert), it's common to omit accents in some languages when changing case.
- mixmastamyk 6y agoI came to write this. Why are accents being disregarded under the case-insensitive comparison section? The proper solution is typically "case fold", however I only know it from Python, not sure if Javascript supports it natively.
- davethedevguy 6y agoThanks for this. I've split 'Handling diacritics' in to a separate section to 'Case sensitivity'.