Handle Unicode text, emoji, encoding, normalization, code points, and safe storage.
Lessons
Understand UTF-8 backward compatibility and efficiency.
Why UTF-8 Won the Web is easiest to learn by reading the example, changing it, and observing the result.
const text = 'Hello 😀';
console.log('UTF-8 bytes:', new TextEncoder().encode(text).length);
console.log('Code points:', [...text].length);
// UTF-8 : 1-4 bytes, ASCII-compatible, dominant on the web
// UTF-16 : 2 or 4 bytes, used internally by JS, Java, Windows
// UTF-32 : always 4 bytes, easy indexing, space-heavyPractice the Why UTF-8 Won the Web example in a small scratch file, then explain what changed and why.