Code point, escape and bytes are three different things
Every character has one number, its code point, written U+ and hex digits. How that number is stored or typed depends on the context.
| Character | Code point | Decimal | UTF-8 bytes | JavaScript escape | HTML |
|---|---|---|---|---|---|
| A | U+0041 | 65 | 41 | \u0041 | A |
| é | U+00E9 | 233 | C3 A9 | \u00E9 | é |
| 한 | U+D55C | 54620 | ED 95 9C | \uD55C | 한 |
| 😀 | U+1F600 | 128512 | F0 9F 98 80 | \uD83D\uDE00 | 😀 |
ASCII is the first 128 code points. For those characters the code point, the decimal ASCII code and the single UTF-8 byte are the same number.
Why an emoji needs two \u escapes
JavaScript and Java strings use 16-bit units. Code points above U+FFFF do not fit in one unit, so they are written as a pair called surrogates: 😀 is \uD83D\uDE00. Modern JavaScript also accepts \u{1F600}. This page reads both forms.
Formats the page understands
U+0041,\u0041,\u{1F600},\x41,0x41- HTML entities
AandA - A list of decimal codes such as
72 101 108 108 111. A single bare number is treated as text, since it is usually meant that way. Switch to “Codes → text” to force it.
Questions
Is Unicode the same as UTF-8?
No. Unicode assigns numbers to characters. UTF-8 is one way to store those numbers as bytes, using one to four bytes per character.
Why does one visible character show several rows?
Some characters are built from several code points: a flag is two, a family emoji can be seven, and an accented letter may be a base letter plus a combining mark.