JavaScript String normalize() method
returns the Unicode Normalization Form of the string

normalize() method returns the Unicode Normalization Form of the string.

syntax

normalize(form)

form (optional). One of NFC, NFD, NFKC, or NFKD, specifying the Unicode Normalization Form.

If omitted or undefined, NFC is used.

normalize() method converts a string to its Unicode Normalization Form.

normalize() method does not change the value of the original string.

normalize() method compares strings that may look the same but may not consist of the same characters.

Unicode each string character has a unique numerical value known as a code point.

A single character can refer to multiple code points.

For example, the character ñ is represented by \u00F1 (single code point) and also by \u006E followed by \u0303

If the code points are different, string comparison will not treat them as equal.

normalize() method converts the string to a normal form where all characters with two or more code points are normalized into one representation.

NFC Normalization Form Canonical Composition. This is the default form.

NFD Normalization Form Canonical Decomposition.

NFKC Normalization Form Compatibility Composition.

NFKD Normalization Form Compatibility Decomposition.

normalize() method returns RangeError if form is not one of the values specified above.

syntax 1 description
convert myString to its Unicode Normalization Form (NFC by default)
myString.normalize()
syntax 2 description
convert myString to its selected Unicode Normalization Form
myString.normalize(form)