utf8(5)

utf85

Utf-8, a transformation format of iso 10646

Usage

ENCODING "UTF-8"

Overview

The UTF-8 encoding represents UCS-4 characters as a sequence of octets, using between 1 and 6 for each character. It is backwards compatible with ASCII, so 0x00-0x7f refer to the ASCII character set. The multibyte encoding of non-ASCII characters consist entirely of bytes whose high order bit is set. The actual encoding is represented by the following table:

[0x00000000 - 0x0000007f] [00000000.0bbbbbbb] -> 0bbbbbbb
[0x00000080 - 0x000007ff] [00000bbb.bbbbbbbb] -> 110bbbbb, 10bbbbbb
[0x00000800 - 0x0000ffff] [bbbbbbbb.bbbbbbbb] ->
	1110bbbb, 10bbbbbb, 10bbbbbb
[0x00010000 - 0x001fffff] [00000000.000bbbbb.bbbbbbbb.bbbbbbbb] ->
	11110bbb, 10bbbbbb, 10bbbbbb, 10bbbbbb
[0x00200000 - 0x03ffffff] [000000bb.bbbbbbbb.bbbbbbbb.bbbbbbbb] ->
	111110bb, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb
[0x04000000 - 0x7fffffff] [0bbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb] ->
	1111110b, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb

If more than a single representation of a value exists (for example, 0x00; 0xC0 0x80; 0xE0 0x80 0x80) the shortest representation is always used. Longer ones are detected as an error as they pose a potential security risk, and destroy the 1:1 character:octet sequence mapping.

Releases

60 releases since FreeBSD 4.8-RELEASE; the text changed 37 times.

  1. 4.8–4.11
  2. 5.0–5.1
  3. 5.2–5.2.1
  4. 5.3–5.5
  5. 6.0–6.3
  6. 6.4
  7. 7.0
  8. 7.1
  9. 7.2
  10. 7.3
  11. 7.4
  12. 8.0
  13. 8.1
  14. 8.2
  15. 8.3
  16. 8.4
  17. 9.0
  18. 9.1
  19. 9.2
  20. 9.3
  21. 10.0
  22. 10.1
  23. 10.2
  24. 10.3
  25. 10.4
  26. 11.0
  27. 11.1
  28. 11.2
  29. 11.3
  30. 11.4
  31. 12.0
  32. 12.1
  33. 12.2
  34. 12.3
  35. 12.4
  36. 13.0–13.2
  37. 13.3–14.5
  38. 15.0–16.0

Standards

The utf8 encoding is compatible with RFC 2279 and Unicode 3.2.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.