Unicode has four main normalization forms. Their codes are NFC
, NFD
, NFKC
, NFKD
. Wikipedia has a good explanation of the topic.
Unicode具有四种主要的规范化形式 。 它们的代码是NFC
, NFD
, NFKC
, NFKD
。 维基百科对该主题有很好的解释 。
The normalize()
method returns the string normalized according to the form you specify, which you pass as parameter (NFC
being the default if the parameter is not set).
normalize()
方法将根据您指定的形式返回标准化的字符串,该字符串将作为参数传递(如果未设置参数,则NFC
为默认值)。
I will reuse the MDN example because I’m sure there is a valid usage but I can’t find another example:
我将重用MDN示例,因为我确定存在有效用法,但找不到其他示例:
'\u1E9B\u0323'.normalize() //ẛ̣
'\u1E9B\u0323'.normalize('NFD') //ẛ̣
'\u1E9B\u0323'.normalize('NFKD') //ṩ
'\u1E9B\u0323'.normalize('NFKC') //ṩ