Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!