Meaning and mechanism
This is a representation of a number where each digit is a power of 2. With ‘n’ bits, it is possible to represent 2ⁿ patterns, and the range of unsigned integers is from 0 to 2ⁿ−1.
Unicode assigns code points to characters, and UTF-8 encodes those code points as byte sequences. A character does not always occupy one byte.
Relationships and conditions
An unsigned integer is read as N=Σbᵢ2ⁱ. UTF-8 uses 1–4 bytes depending on the code point, so a string’s byte count may differ from its character count.
The units appearing on the screen can be composed of multiple code points. Units with delimiters and integer values use separate interpretation rules than other character encodings.
What to observe in the simulation
The same bits convey different information under different interpretations.
Integers are unsigned 8-bit. UTF-8 encodes the selected Unicode character into actual bytes.
Key relationships and symbols
N = Σbᵢ2ⁱ · count = 2ⁿ
| Symbol | Meaning | Unit |
|---|---|---|
| bᵢ | i-th bit | 0 or 1 |
| byte | Group of 8 bits | 8 bit |
| Code point | Unicode character identifier | Integer identifier |
Worked example
Is every UTF-8 character one byte?
It varies by character · The same bits convey different information under different interpretations.
Common misconceptions
- Knowing only that a bit sequence is 8 bits long does not always identify which character it represents.
