Visual RFC.
ALL RFCs / RFC 2781
Read the RFC ↗
RFC 2781 / UTF-16 REPRESENTATION

Decode a pair and stop at malformed input

02

A decoder distinguishes ordinary units, high surrogates and low surrogates. A high surrogate needs a following low surrogate before one scalar can be recovered.

RFC 2781 · § 2.2EXAMPLE
5 / 5
Decode a pair and stop at malformed inputSeparateD8080041pair errors because0041is not a low surrogate.Check code-unit roles before producing a scalarD8080041Separate error: 0041 is not a low surrogatereport error; stop this decodeRecovery policy is not specified hereError in one decoding step ≠ mandated abort of the entire stream
05
Report a wrong second unit

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 ↗

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
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.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

KEY POINT

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.
DETAILS

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 ↗

All chapters in RFC 2781

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗