text === '' only checks whether text is exactly an empty JavaScript string. It does not tell you whether Unicode normalization changed the string, or whether the result still contains meaningful text. To compare canonically equivalent Unicode strings, normalize both values to the same form and then compare them; to check for emptiness, test the normalized result separately.
What text === '' actually checks
JavaScript string equality is sensitive to the underlying sequence of code points. The expression text === '' is true only when text contains no code units at all. It does not normalize text first, and it does not detect that normalization changed a representation.
As an Amazon Associate I earn from qualifying purchases.
For example, “Amélie” can use a single precomposed é (U+00E9), or an e followed by a combining acute accent (U+0065 U+0301). The strings look alike but are different sequences, so a direct equality check can return false. MDN demonstrates this behavior and shows both strings comparing equal after NFC normalization: MDN: String.prototype.normalize().
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Normalize before comparing canonical equivalents
If your application treats canonically equivalent text as equal, normalize both operands to the same canonical form before comparing:
#1 Best Overall
const sameCanonicalText = a.normalize("NFC") === b.normalize("NFC");
String.prototype.normalize() returns a string in the requested Unicode normalization form; if you omit the form, it defaults to NFC. NFC canonically decomposes and then recomposes where possible. NFD canonically decomposes without recomposition. Either form can support comparison of canonically equivalent inputs, provided both values use the same form. See the Unicode Consortium’s normalization FAQ and Unicode Standard Annex #15.
For instance, the two common encodings of “ñ” are U+00F1 and U+006E U+0303. Normalizing both to NFC or both to NFD gives them a consistent representation for comparison. Normalization is a representation policy: it does not mean every character that looks similar is equivalent.
Rank #2
Check emptiness as a separate requirement
If the intended rule is “the normalized value must be empty,” test that value explicitly:
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →const normalized = text.normalize("NFC");
const isEmptyAfterNormalization = normalized === "";
For canonical normalization, this is not a general detector for data loss. NFC and NFD reconcile canonically equivalent encodings; they are not a command to remove accents, punctuation, or all visible characters. If your concern is whether a transformation changed the representation, compare the original with the normalized result:
const normalized = text.normalize("NFC");
const changedByNormalization = normalized !== text;
That comparison reports a representation change, not whether information meaningful to your application was lost. Define the application’s rules for what counts as meaningful text separately.
Choose compatibility normalization only for a deliberate purpose
NFKC and NFKD apply compatibility decomposition, which treats a broader set of characters as equivalent than NFC and NFD do. For example, the ligature “ff” (U+FB00) can be transformed to ff by NFKD, even though those strings are not canonically equivalent. Such folding may suit a search or matching policy, but it can erase distinctions that matter in display or meaning.
Rank #4
- Use NFC or NFD when the goal is consistent handling of canonical equivalents.
- Use NFKC or NFKD only when the application intentionally wants compatibility distinctions folded, such as for a particular search policy.
- Do not treat any normalization form as universal cleanup or assume visually similar text will become equal.
A practical comparison pattern
- Decide what “equal” means for the feature: exact sequence equality, canonical equivalence, or broader compatibility equivalence.
- If normalization matches that policy, apply the same chosen form to both strings, such as
a.normalize("NFC")andb.normalize("NFC"). - Compare the normalized strings with
===. - Handle emptiness or other content validation as a separate check on the value your application intends to use.
The built-in normalize() method is documented by MDN as available across browsers since September 2016; consult its compatibility information if your supported runtime set is unusual.
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.




