Is this invisible front item a note or real text?
04An optional front signature can hint at the encoding. The same item inside the text is actual text.
The labeled tiles show things a normal display may hide.
Stored text items
What happens if you change this?
Make one change, then watch again. Restart restores the original example.
Do not interpret a signature as a byte-order switch.
Key idea: Position and the containing format decide meaning. Do not erase invisible text just because it looks like nothing.
Terms
- UTF-8
- A rule for turning Unicode character numbers into ordered bytes, and back.
- Code point
- A character number in Unicode. A scalar value excludes reserved surrogate numbers.
- Byte / bit
- A byte is eight bits. A bit has one of two values: zero or one.
- Leading / continuation byte
- The first piece tells the reader how many bytes belong together. Following pieces start with the bits 10.
- Normalization
- A specified way to transform Unicode text before comparison. It does not turn every lookalike into the same letter.
- BOM
- A contextual initial encoding signature. UTF-8 never uses it to switch byte order.
Rules & examples
Position and the containing format decide meaning. Do not erase invisible text just because it looks like nothing.
- The BOM is not required to determine endianness in UTF-8.
- Protocols should specify whether an initial signature is allowed.
- Blindly stripping meaningful data can affect signatures or character interpretation.
Examples are illustrative. Consult the linked RFC and its errata for implementation details.
RFC 3629 §6. U+FEFF encodes as EF BB BF. Initial signature interpretation is contextual; non-initial U+FEFF MUST NOT be interpreted as a signature. Avoid stripping an initial signature without a good reason because counts/signatures may depend on it. Here the first-only operation removes it only when interpreted as a signature. Source EF BB BF 41 42; resulting bytes EF BB BF 41 42.
Sources
New to this? Start hereA quick picture + helpful background
First, agree how to read the message.
An encoding tells a reader how to interpret bytes. A format tells it how values fit together. Correctly reading a value does not make that value trustworthy.
Start with this guide; no earlier guide is needed for the overview.
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.