Encode characters into UTF-8 bytes
03First turn text into UTF-8 bytes. Then represent bytes outside attr-char as percent escapes; this is byte encoding, not an HTML form or a recursive decoder.
The fictional value A+B%20C%2A%27%25 decodes to A+B C*'%. A separate %2520 sample becomes %20 after one layer; it is not a space.
Source for this drawing: RFC 8187 · Read RFC section 3.2.3 ↗
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
- UTF-8 byte
- One octet in the encoded representation; a character can use several bytes.
- Percent escape
- A percent sign followed by two hexadecimal digits representing one byte.
- attr-char
- An ASCII character permitted directly in the encoded value data.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
Encode bytes, preserve literal plus signs and decode each encoding layer once.
- The pound sign £ (U+00A3) becomes UTF-8 bytes C2 A3, then %C2%A3. A space becomes %20 because space is not attr-char.
- Hex digits in percent escapes can be uppercase or lowercase. The official example with £ and € has UTF-8 bytes C2 A3 and E2 82 AC; both language omission and lowercase hex are valid.
- attr-char includes letters, digits and ! # $ & + - . ^ _ ` | ~. It excludes * and apostrophe and percent, which must be percent-encoded when used as value data; curly braces are excluded too.
- A literal + is data, not a space. For the one RFC 8187 layer, %2520 decodes to the literal three characters %20, not recursively to a space. Do not use HTML-form plus-to-space decoding for this value.
The first two states construct the official pound-sign example. The third is another official example, not a subsequent response. The final A+B example is fictional and isolates allowed punctuation. Percent encoding is not encryption. Supporting sources: RFC 3629 §§3–4 and RFC 3986 §2.1.
Read the RFC section ↗