Decode a pair and stop at malformed input
02A decoder distinguishes ordinary units, high surrogates and low surrogates. A high surrogate needs a following low surrogate before one scalar can be recovered.
Separate malformed example: D808 is followed by 0041, which is not a low surrogate. Report the pair error; recovery belongs to a separately chosen policy.
Source for this drawing: RFC 2781 · Read RFC source: § 2.2 ↗
New to this? Start hereA quick picture + helpful background
A message needs an address.
Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Terms in this drawing
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
A first unit outside D800–DFFF stands alone; a first unit in DC00–DFFF is an error for this decoding step.
- A first unit outside D800–DFFF stands alone; a first unit in DC00–DFFF is an error for this decoding step.
- A high surrogate D800–DBFF must be followed by a low surrogate DC00–DFFF. Missing or wrong second units are errors.
- Combine the two low-ten-bit values and add 10000 hex. RFC2781 does not specify error recovery; an error is not a mandate to abort the whole text stream or silently replace it.
The drawings stop the invalid decoding path before a scalar output. This is a bounded single-scalar teaching decoder, not a mandated stream-wide recovery policy or a validator of character assignment, normalization or application safety.
Read the RFC section ↗