iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
text === '' only checks whether text is exactly an empty string. It does not tell you whether Unicode normalization changed the string. To check for a change, compare the original with its normalized form; to compare canonically equivalent text, normalize both values to the same form before comparing them.
What the empty-string check actually tells you
In JavaScript, text === '' is a strict equality test against the empty string. It is true when text contains no characters and false otherwise. It does not inspect how Unicode characters are encoded, and it does not report whether a transformation changed the text.
Unicode normalization can make a representation more consistent. For example, “é” can be represented as one precomposed code point, U+00E9, or as the letter e followed by the combining acute accent, U+0065 U+0301. These strings look alike, but JavaScript compares their code-point sequences, so they are not strictly equal before normalization.
Check whether normalization changed a value
Normalize a value, then compare the result with the original if your specific question is whether that operation changed its representation:
#1 Best Overall
const normalized = text.normalize("NFC");
const changed = normalized !== text;
If changed is true, the normalized string differs from the input. That does not by itself mean data was lost: it means normalization produced a different sequence. If the value remains unchanged, the comparison is false.
This check answers a different question from text === ''. Use an empty-string check when you need to know whether a value is empty; use the before-and-after comparison when you need to know whether normalization changed it.
Rank #2
Compare strings by canonical equivalence
If the intended rule is that canonically equivalent text counts as equal, normalize both operands to the same form before comparing them:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →const sameCanonicalText = a.normalize("NFC") === b.normalize("NFC");
For example, the two encodings of “Amélie” can compare unequal directly but compare equal after both are normalized to NFC. The JavaScript String.prototype.normalize() method returns a string in the requested normalization form; when no form is supplied, it defaults to NFC.
NFC and NFD are both canonical forms. NFC performs canonical decomposition followed by composition; NFD performs canonical decomposition. Either can be used for a comparison policy if both strings are transformed consistently. The choice determines the representation, not whether the original operands should be normalized symmetrically.
Choose a normalization form that matches the equality you need
| Forms | What they do | When they fit |
|---|---|---|
| NFC | Canonical decomposition followed by composition | Canonical-equivalence comparisons using a composed representation |
| NFD | Canonical decomposition | Canonical-equivalence comparisons using a decomposed representation |
| NFKC | Compatibility decomposition followed by composition | Only when broader compatibility folding is intended |
| NFKD | Compatibility decomposition | Only when broader compatibility folding is intended |
NFKC and NFKD cover compatibility equivalence, which is broader than canonical equivalence. For example, the ligature “ff” (U+FB00) is compatible with ff, though the two are not canonically equivalent. Compatibility normalization can remove distinctions that matter in display or meaning, so it is not a universal cleanup step. It may suit a search comparison when that broader folding is intentional.
Rank #4
Keep display, comparison, and change detection separate
- To test emptiness: use
text === ''. - To see whether normalization changed a string: compare the normalized result with the original.
- To compare canonical equivalents: normalize both strings to the same canonical form, then compare.
- To fold compatibility distinctions: use NFKC or NFKD only when that broader equivalence is appropriate for the task.
Normalization does not make every visually similar string equal. It addresses specific Unicode equivalences; it is not a general visual-similarity test.
Recommended Free Tools
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

