Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
Why normalize() method doesn't work in some cases?

By default, String.prototype.normalize() uses NFC as an argument. NFC replaces multiple characters with single one.

MDN

You can specify "NFC" to get the composed canonical form, in which multiple code points are replaced with single code points where possible.

And here's an example from MDN. It works.

let str = '\u006E\u0303';
str = str.normalize();
console.log(`${str}: ${str.length}`);

But then I decided to try this method with other characters. For example:

let str = '\u0057\u0303';
str = str.normalize();
console.log(`${str}: ${str.length}`);

What's wrong in the second example? Why doesn't it work?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It doesn't replace multiple characters it replaces multiple codepoints and only where possible.

ñ, being a character used in Spanish has its own codepoint in unicode: — U+00D1 — so you can just say ñ instead of "Take an n and then put a ~ on top of it".

W̃, being a representation of a phonic sound doesn't have its own codepoint. It is a character used comparatively rarely so hasn't been given precious space in the more efficient bits of Unicode. The only way you can have one is to say "Take a W and then put a ~ on top of it".

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda